Hi Peng,
I do not know your goal to "create an ERE expression for any literal string"
means.
But what your "sed -e 's/\([][?+{|()\]\)/\\\1/g' " does is to prefix any of the
characters in
the set '\?+{|()[]' with a backslash ... so if that's what you want, then I
think you have it.
I am a bit surprised that this pattern works, as the [...] class lacks a
closing ']' character.
The following alternative is shorter, does the same thing, and I find less
surprising:
sed -e 's/[]\\[?+{|()]/\\&/g'
--
Paul Jackson
[email protected]