diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-09-29 11:06:20 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-09-29 11:06:20 +0200 |
| commit | 98fcba37eee4e6d825aa1674529301e7c77649a2 (patch) | |
| tree | a1c541c7a475e5921b2daeee1da36eacfb7a40a8 /urlgrep | |
| parent | 927e35f80483f55d91f2e9a3f84b81768fdf73e1 (diff) | |
| parent | a04beb5ea91ceac2d6a06f344527ed4d1c8e6fd0 (diff) | |
| download | scripts-98fcba37eee4e6d825aa1674529301e7c77649a2.tar.gz scripts-98fcba37eee4e6d825aa1674529301e7c77649a2.zip | |
Merge branch 'master' of tronto.net:scripts
Diffstat (limited to 'urlgrep')
| -rwxr-xr-x | urlgrep | 8 |
1 files changed, 2 insertions, 6 deletions
| @@ -1,12 +1,8 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Find all url in stdin, print them newline-separated to stdout | 3 | # Find all URLs in stdin, print them newline-separated to stdout |
| 4 | 4 | ||
| 5 | # Old regex (PCRE), kept it for later review: | 5 | protocols='http|https|ftp|sftp|gemini|mailto' |
| 6 | # reg='(((http|https|ftp)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]' | ||
| 7 | # grep -Po "$reg" | ||
| 8 | |||
| 9 | protocols='http|https|ftp|gemini|mailto' | ||
| 10 | valid_chars="][a-zA-Z0-9_~/?#@!$&'()*+=.,;:-" | 6 | valid_chars="][a-zA-Z0-9_~/?#@!$&'()*+=.,;:-" |
| 11 | regex="(($protocols):|www\.)[$valid_chars]+" | 7 | regex="(($protocols):|www\.)[$valid_chars]+" |
| 12 | 8 | ||
