Reading the manual for GNU grep, the special characters (with -E option) are .?*+{|()[\^$
.
This is a somewhat pedantic question, but why are ]
and }
omitted? In particular it says in section 3.1 "An unmatched )
just matches itself", which is true for ]
and }
as well.
I think it is just a slightly sleeker description of ERE–we can get by without }
and ]
being special, because their syntactic purpose is served only in a context where specialness fails to be meaningful (that is, after an unmatched {
or [
has occurred).
Note that this is not a question about GNU grep per se, but rather about the syntactic rules of ERE.
()
versus{}
and[]
is that()
can be nested. If you have an unmatched)
within nested parentheses, you end up with an ambiguous expression. $\endgroup$