Skip to content

Instantly share code, notes, and snippets.

@enisozgen
Created September 10, 2021 08:27
Show Gist options
  • Save enisozgen/51cb69ef06724c644d07e4ad69a97329 to your computer and use it in GitHub Desktop.
Save enisozgen/51cb69ef06724c644d07e4ad69a97329 to your computer and use it in GitHub Desktop.
visualize your regular expression easily on your browser
#!/bin/sh
# https://unix.stackexchange.com/a/152025/457201
# 1 . Usage copy the regular expression which is hard to understand
# 2. Run `sh regulex.query.sh`
mk_regulex_query() {
url_encode() {
# http://stackoverflow.com/a/298258/3541063
perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$1"
}
echo "https://jex.im/regulex/#!flags=&re=`url_encode "$1"`"
}
SEARCH_TEXT=`/usr/bin/xsel --clipboard`
xdg-open `mk_regulex_query "$SEARCH_TEXT"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment