[Tutor] Regex with Python

Oscar Picasso picasso@videotron.ca
Thu, 02 Dec 1999 10:03:05 -0500


Hi,

I don't know if the problem I have specific to Python or it is I
misunderstand regexes. Here is my code:

import re

st='This is string. "With a quoted \\"string\\" inside it." A single quote
". Here is the end of the string.'

s='("([^"]|(\\"))*")'

pat=re.compile(s)
r=pat.search(st)
print r.group(0)
>>> "With a quoted \"string\" inside it." A single quote "

I expected:
>>> "With a quoted \"string\" inside it."

I don't see where is my mistake. 

Thanks

******************************************************
Oscar Picasso
picasso@videotron.ca
******************************************************