remove final punctuation from possible urls

This commit is contained in:
Luke Smith 2021-03-03 21:39:35 -05:00
parent ebb7b6c96a
commit 67ef1c4d4e
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -5,7 +5,8 @@ urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:]?[
urls="$(sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sidebars: urls="$(sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sidebars:
grep -aEo "$urlregex" | # grep only urls as defined above. grep -aEo "$urlregex" | # grep only urls as defined above.
uniq | # Ignore neighboring duplicates. uniq | # Ignore neighboring duplicates.
sed 's/^www./http:\/\/www\./g')" # xdg-open will not detect url without http:// sed "s/\(\.\|,\|;\|\!\\|\?\)$//;
s/^www./http:\/\/www\./")" # xdg-open will not detect url without http
[ -z "$urls" ] && exit 1 [ -z "$urls" ] && exit 1