Skip to content

Commit

Permalink
linkfile: improve the URL regex
Browse files Browse the repository at this point in the history
By requiring a "non-word" letter or start-of-line before the URL
  • Loading branch information
bagder committed Mar 8, 2017
1 parent e522838 commit 69583d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions roffit
Expand Up @@ -10,7 +10,7 @@
# Author: Daniel Stenberg <daniel@haxx.se>
# Web: https://daniel.haxx.se/projects/roffit

my $version = "0.11";
my $version = "0.12";

use strict;
#use warnings;
Expand Down Expand Up @@ -219,7 +219,7 @@ sub linkfile {
}

# convert https://, http:// and ftp:// URLs to <a href> links
$field =~ s/(^|[\"\s])((?:https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=]+)/$1<a href=\"$2\">$2<\/a>/gi;
$field =~ s/(^|\W)((https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=]+)/$1<a href=\"$2\">$2<\/a>/gi;

# convert (uppercase only) "RFC [number]" to a link
$field =~ s/(^|[\"\s])RFC ?(\d+)/$1<a href=\"http:\/\/www.ietf.org\/rfc\/rfc$2.txt\">RFC $2<\/a>/g;
Expand Down

0 comments on commit 69583d3

Please sign in to comment.