[Tutor] RE module is working ?
Peter Otten
__peter__ at web.de
Fri Feb 4 11:26:13 CET 2011
Karim wrote:
> That is not the thing I want. I want to escape any " which are not
> already escaped.
> The sed regex '/\([^\\]\)\?"/\1\\"/g' is exactly what I need (I have
> made regex on unix since 15 years).
Can the backslash be escaped, too? If so I don't think your regex does what
you think it does.
r'\\\"' # escaped \ followed by escaped "
should not be altered, but:
$ echo '\\\"' | sed 's/\([^\\]\)\?"/\1\\"/g'
\\\\" # two escaped \ folloed by a " that is not escaped
More information about the Tutor
mailing list