Posts

Showing posts from April 10, 2019

Hex code for '(' in bash regex

Image
1 I have a strange behaviour in shell. When I try to match '_' in regex with its hex code it works, but not with '('. $ regex1=$'x5f' $ pattern1='_' $ if [[ $pattern1 =~ $regex1 ]]; then echo yes; else echo no; fi yes $ regex2=$'x28' $ pattern2='(' $ if [[ $pattern2 =~ $regex2 ]]; then echo yes; else echo no; fi no Can you explain this behaviour ? bash shell regular-expression ascii hex share | improve this question edited Dec 19 '18 at 15:11 ilkkachu 55.9k 7 84 155