url-select: New default regex, fixes issue #47
This commit is contained in:
parent
e54f4c238e
commit
a4eed96cc6
14
url-select
14
url-select
@ -70,10 +70,15 @@ sub on_start {
|
|||||||
$current++;
|
$current++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@{$self->{pattern}} = qr{(
|
@{$self->{pattern}} = qr{
|
||||||
(?:https?://|ftp://|news://|git://|mailto:|file://|www\.)
|
(?:https?://|ftp://|news://|mailto:|file://|\bwww\.)
|
||||||
[\w\-\@;\/?:&=%\$_.+!*\x27(),~#]+[\w\-\@;\/?&=%\$_+!*\x27()~]
|
[\w\-\@;\/?:&=%\$.+!*\x27,~#]*
|
||||||
)}x;
|
(
|
||||||
|
\([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\) # Allow a pair of matched parentheses
|
||||||
|
| #
|
||||||
|
[\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic)
|
||||||
|
)+
|
||||||
|
}x;
|
||||||
}
|
}
|
||||||
|
|
||||||
()
|
()
|
||||||
@ -234,7 +239,6 @@ sub select_next {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
my ($beg, $end) = ($-[0], $+[0]);
|
my ($beg, $end) = ($-[0], $+[0]);
|
||||||
--$end if $& =~ /['")]$/;
|
|
||||||
push @{$self->{found}}, [$line->coord_of($beg),
|
push @{$self->{found}}, [$line->coord_of($beg),
|
||||||
$line->coord_of($end), substr($text, $beg, $end - $beg)];
|
$line->coord_of($end), substr($text, $beg, $end - $beg)];
|
||||||
} while ($text =~ /$pattern/g);
|
} while ($text =~ /$pattern/g);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user