Help with regular expression using findall and .*?
OKB (not okblacke)
BrenBarn at aol.com
Thu Sep 12 21:35:02 EDT 2002
czrpb wrote:
> p=re.compile(r'macro.*?orcam',re.DOTALL)
>
> for x in re.findall(p,s1):
> print x
>
> for x in re.findall(p,s2):
> print x
>
If you use re.findall directly you need to pass a pattern string
in, not a compiled object, and I don't think there's a way to specify
flags with that approach. Instead, use the findall method on your
compiled expression object:
for x in p.findall(s1):
print x
--
--OKB (not okblacke)
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
More information about the Python-list
mailing list