From e3858af7c3057a12a36c47e3fd50009f4af81c3a Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 6 Jan 2018 14:44:48 +0100 Subject: BBCode: Fix word boundary check when dblink is the first token --- lib/VNDB/BBCode.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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; -- cgit v1.2.3