bash test regex examples Example: using regex in bash conditional statement pat="[0-9a-zA-Z ]" if [[ $x =~ $pat ]]; then ...