summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2018-01-06 14:44:48 +0100
committerYorhel <git@yorhel.nl>2018-01-06 14:44:48 +0100
commite3858af7c3057a12a36c47e3fd50009f4af81c3a (patch)
tree74c437846887a238165a96b6b0c63b88ca1db548 /lib/VNDB
parent11963a54f3e86812e9bd3f542da57d1163c9d5ff (diff)
BBCode: Fix word boundary check when dblink is the first token
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/BBCode.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNDB/BBCode.pm b/lib/VNDB/BBCode.pm
index 95a90d16..b95ef760 100644
--- a/lib/VNDB/BBCode.pm
+++ b/lib/VNDB/BBCode.pm
@@ -118,8 +118,8 @@ sub parse {
(?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-] # link
)}xg) {
my $token = $&;
- my $pre = substr $raw, $last, (pos($raw)-length($&))-$last;
- my $char_pre = $last ? substr $raw, pos($raw)-length($&)-1, 1 : '';
+ my $pre = substr $raw, $last, $-[0]-$last;
+ my $char_pre = $-[0] ? substr $raw, $-[0]-1, 1 : '';
$last = pos $raw;
my $char_post = substr $raw, $last, 1;