From: Eric Wong Date: Sun, 30 Aug 2015 00:12:31 +0000 (+0000) Subject: view: update linkification regexp to be more domain sensitive X-Git-Tag: v1.0.0~964 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=f401be8bf5612178074d8d037776fee9e27bfd4c view: update linkification regexp to be more domain sensitive This avoids capturing links such as "http://#{foo}" => "http://#" inside diffs --- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 08d78945..bd0a27aa 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -244,7 +244,9 @@ sub add_filename_line { "$pad " . ascii_html($fn) . " $pad\n"; } -my $LINK_RE = qr!\b((?:ftp|https?|nntp)://[@\w\+\&\?\.\%\;/#=-]+)!; +my $LINK_RE = qr!\b((?:ftp|https?|nntp):// + [\@:\w\.-]+/ + ?[\@\w\+\&\?\.\%\;/#=-]*)!x; sub linkify { # no newlines added here since it'd break the splitting we do