This may not be enough for what you really want to do, but, given what
you have shown above, regex is the wrong tool for the job.
Use the string method startswith:
for line in ProcMem.split('\n'):
if line.startswith( 'Mem' ):
# do stuff
--
http://mail.python.org/mailman/listinfo/pyt
"fileexit" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> Would someone please tell me what is going on here??!! Why does the
> following code work
>
> >>> a=r"Mem"
> >>> pat = re.compile(a)
> >>> m=pat.search(ProcMem, re.DOTALL)
> >>> m
> <_sre.SRE_Match object at 0xb7f7eaa0>
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.