Regular expression gone mad

Rene Pijlman reply.in.the.newsgroup at my.address.is.invalid
Mon Feb 20 06:20:54 EST 2006


fileexit:
>(Search finds nothing)
>
>>>> a=r"MemT"
>>>> pat = re.compile(a)
>>>> m=pat.search(ProcMem, re.DOTALL)
>>>> m

>From the docs:

"Compiled regular expression objects support the following methods and
attributes: 
match( string[, pos[, endpos]])"

Your re.DOTALL is seen as start position. That's why it's probably
matching 'MemFree' instead of 'MemTotal'.

-- 
René Pijlman



More information about the Python-list mailing list