Matching regexps directly in bash
It may be old news to everyone, but again, it may not.
#!/bin/bash
regxp="[a-z]+[0-9]*"
if [[ $string =~ $regexp ]]
then
#do stuff
fi
Written by Knut Haugen
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#