commit 98fcba37eee4e6d825aa1674529301e7c77649a2
parent 927e35f80483f55d91f2e9a3f84b81768fdf73e1
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Fri, 29 Sep 2023 11:06:20 +0200
Merge branch 'master' of tronto.net:scripts
Diffstat:
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/urlgrep b/urlgrep
@@ -1,12 +1,8 @@
#!/bin/sh
-# Find all url in stdin, print them newline-separated to stdout
+# Find all URLs in stdin, print them newline-separated to stdout
-# Old regex (PCRE), kept it for later review:
-# reg='(((http|https|ftp)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]'
-# grep -Po "$reg"
-
-protocols='http|https|ftp|gemini|mailto'
+protocols='http|https|ftp|sftp|gemini|mailto'
valid_chars="][a-zA-Z0-9_~/?#@!$&'()*+=.,;:-"
regex="(($protocols):|www\.)[$valid_chars]+"