regex, repeating group

Steven Scott progoth at progoth.com
Fri May 30 16:37:43 EDT 2003


Riccardo Galli wrote:
> re.findall(regex,str)
> you'll get
> [('From:you\n', 'you'), ('Attendees:me\n', 'me'), ('Date:now\n', 'now'),
> ('ID:0', '0')]

well that would find anything in the whole body of the thing I'm parsing, I 
only want the data if it's in this exact format.  hence the extra stuff at 
the beginning of the regex and the $ at the end:-\

> note: it's really a bad idea use 'str' as variable name, 'cause it's a
> type name.

that wasn't actually in my code, just an example

-- 
Steven Scott [progoth at progoth.com]
Don't give up fighting, 'til nothing else stands in your way..Don't
give up talking, until there's nothing left to say....But no matter
what you do, don't ever compromise what you believe.   --The Ataris





More information about the Python-list mailing list