Gert Cuykens wrote:
rex2=re.compile('^"(?P<value>[^]*)"$',re.M)
File "/usr/lib/python2.5/re.py", line 180, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.5/re.py", line 233, in _compile
raise error, v # invalid expression
sre_constants.error: unexpected end of regular expression
?
You probably want
rex2=re.compile('^"(?P<value>[\^]*)"$',re.M)
Because [] is a bracketed group and the ^ within a bracketed group is a
negation, but you have negated nothing before closing the group.
Alternatively:
rex2=re.compile('^"(?P<value>\^*)"$',re.M)
Would have the same meaning, avoiding the bracketed group altogether.
James