improve magnet link regex pattern
This commit is contained in:
parent
8b6a258a5e
commit
b19632f496
2
Makefile
2
Makefile
@ -44,9 +44,11 @@ install: st
|
||||
cp -f st $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f st-copyout $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f st-urlhandler $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f st-weechatlinks $(DESTDIR)$(PREFIX)/bin
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-copyout
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-urlhandler
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-weechatlinks
|
||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)"
|
||||
urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9&=%-\.]*)"
|
||||
|
||||
urls="$(sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sidebars:
|
||||
grep -aEo "$urlregex" | # grep only urls as defined above.
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
buffer="$(cat)"
|
||||
#URLs:
|
||||
urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./@$&%?$\!\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)"
|
||||
urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./@$&%?$\!\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9&=%-\.]*)"
|
||||
|
||||
urls="$(echo "$buffer" | sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sidebars:
|
||||
grep -aEo "$urlregex" | # grep only urls as defined above.
|
||||
|
Loading…
Reference in New Issue
Block a user