how to right the regular expression ?

MRAB python at mrabarnett.plus.com
Thu Feb 14 20:26:46 EST 2013


On 2013-02-15 00:32, python wrote:
> the regex--- pat = r'([a-z].+?\s)(.+?)((\(.+\)))?$' ,do not work at all.
>
[snip]
Sorry, that should be:

pat1 = r'([a-z].+?\s)(.+?)((\(.+\)))?$'

Group 2 should've been lazy "(.+?)", and because of that it should've
forced matching the end of the line with "$".




More information about the Python-list mailing list