regex confusion

A.M. Kuchling amk at amk.ca
Tue Dec 9 11:33:52 EST 2003


On Tue, 09 Dec 2003 09:43:24 -0600, 
	John Hunter <jdhunter at ace.bsd.uchicago.edu> wrote:
>   rgxPrev = re.compile('.*?a.*?')

. doesn't match newlines unless you specify the re.DOTALL / (?s) flag, so it
won't match unless 'a' is on the very first line.  Add (?s) to your
expression, and it should work (though it'll be much slower than the .find()
method).

--amk




More information about the Python-list mailing list