I'm trying to get this regex to work egrep '[a-zA-Z\]\[]*' <<< '{[dict]}'
Both of these work
% egrep '[a-zA-Z\]]*' <<< '{[dict]}'
{[dict]}
% egrep '[a-zA-Z\[]*' <<< '{[dict]}'
{[dict]}
but for some reason having both [ and ] together produces no matches
Also if I add -o
I get
% egrep -o '[a-zA-Z\]]*' <<< '{[dict]}'
d
i
c
t]
CodePudding user response:
What you're trying, modified to conform to that rule, works:
$ egrep '[]a-zA-Z\[]*' <<< '{[dict]}'
{[dict]}