From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 19F811FD1F for ; Sun, 30 Aug 2015 00:29:56 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] view: update linkification regexp to be more domain sensitive Date: Sun, 30 Aug 2015 00:29:55 +0000 Message-Id: <1440894595-506-1-git-send-email-e@80x24.org> List-Id: This avoids capturing links such as "http://#{foo}" => "http://#" inside diffs --- lib/PublicInbox/View.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 08d7894..bd0a27a 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 -- EW