… | |
… | |
8 | |
8 | |
9 | () |
9 | () |
10 | } |
10 | } |
11 | |
11 | |
12 | my @patterns = ( |
12 | my @patterns = ( |
13 | # urls |
13 | # urls, just a heuristic |
14 | qr{ ([a-z0-9.+\-]+://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),]+) }x, |
14 | qr{( |
|
|
15 | (?:https?|ftp|news|mailto|file)://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),]+ |
|
|
16 | [^.] # do not include a trailing dot, its wrong too often |
|
|
17 | )}x, |
15 | |
18 | |
16 | # shell-like argument quoting |
19 | # shell-like argument quoting |
17 | qr{\G\s*( |
20 | qr{\G [\ \t|&;<>()] *( |
18 | (?: |
21 | (?: |
19 | [^"'\\ \t]+ |
22 | [^\\"'\ \t|&;<>()]+ |
20 | | \\. |
23 | | \\. |
21 | | " ([^\\"]+ | \\. )* " |
24 | | " ([^\\"]+ | \\. )* " |
22 | | ' [^']* ' |
25 | | ' [^']* ' |
23 | )+ |
26 | )+ |
24 | )}xs, |
27 | )}xs, |