What does [[]] mean in regex?
$ echo '[][]' | grep -oE '[[]]' [] [] $ grep --version grep (GNU grep) 2.10
Hmm, it seems like it matches [] . (Sequences of characters [] , not [ or ] .) (I tested it with the python re module, the same result.) Really? If so, why?
I knew if I wanted to match [ or ] , I had to write [][] or [[\]] . (They work in PCRE, grep supports [][] , but not [[\]] , since \ loses its special meaning in the grep bracket expression.) I'm only curious.
source share