re.match and non-alphanumeric characters

Diez B. Roggisch deets at nospam.web.de
Sun Nov 16 18:19:53 EST 2008


John Machin schrieb:
> On Nov 17, 4:44 am, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> 
>>  Match matches the whole string.
> 
> *ONLY* if the pattern ends with "$" or r"\Z"


You think so?

import re

rex = re.compile("abc.*def")

if rex.match("abc0123455678def"):
     print "matched"



Diez



More information about the Python-list mailing list