]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Linkify.pm
linkify: be stricter about matching RFC 3986
[public-inbox.git] / lib / PublicInbox / Linkify.pm
index d4df689e495ad8fd5babfec0989415c10a7e4ad3..ea7fd71f13ca6d7f8a0909b271be95a03be1b2aa 100644 (file)
@@ -17,7 +17,10 @@ use Digest::SHA qw/sha1_hex/;
 my $SALT = rand;
 my $LINK_RE = qr{\b((?:ftps?|https?|nntps?|gopher)://
                 [\@:\w\.-]+/
-                ?[!,:~\$\@\w\+\&\?\.\%\;/#=-]*)}x;
+                (?:[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]*)
+                (?:\?[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]+)?
+                (?:\#[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%\?]+)?
+                )}xi;
 
 sub new { bless {}, shift }