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



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to