In bash, how do I check if a string variable matches a given regular expression? It should be the fastest and most portable (OS X, Linux) method possible.
Basically I want:
if [ $MY_VAR matches '[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}' ]; then
echo 'matched'
fi