aboutsummaryrefslogtreecommitdiff
path: root/urlgrep
blob: 665f19a79c4128ce2097911b983887a48bab607e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

# Find all url 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'
valid_chars="][a-zA-Z0-9_~/?#@!$&'()*+=.,;:-"
regex="(($protocols):|www\.)[$valid_chars]+"

egrep -o "$regex"

Generated with cgit - Back to sebastiano.tronto.net