diff options
Diffstat (limited to '')
| -rwxr-xr-x | urlgrep | 9 |
1 files changed, 7 insertions, 2 deletions
| @@ -2,7 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | # Find all url in stdin, print them newline-separated to stdout | 3 | # Find all url in stdin, print them newline-separated to stdout |
| 4 | 4 | ||
| 5 | reg='(((http|https|ftp)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]' | 5 | # Old regex (PCRE), kept it for later review: |
| 6 | # reg='(((http|https|ftp)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]' | ||
| 7 | # grep -Po "$reg" | ||
| 6 | 8 | ||
| 7 | grep -Po "$reg" | 9 | protocols='http|https|ftp|gemini|mailto' |
| 10 | valid_chars="][a-zA-Z0-9_~/?#@!$&'()*+=.,;:-" | ||
| 11 | regex="(($protocols):|www\.)[$valid_chars]+" | ||
| 8 | 12 | ||
| 13 | egrep -o "$regex" | ||
