RE Help
Thomas Jollans
thomas at jollans.com
Fri Sep 21 16:09:28 EDT 2007
More information about the Python-list mailing list
Fri Sep 21 16:09:28 EDT 2007
- Previous message (by thread): RE Help
- Next message (by thread): RE Help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Friday 21 September 2007, byte8bits at gmail.com wrote: > Not specific to Python, but it will be implemented in it... how do I > compile a RE to catch everything between two know values? Here's what > I've tried (but failed) to accomplish... the knowns here are START and > END: > > data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" > x = re.compile('START.END', re.DOTALL) > > x.findall(data) I'm not sure finding a variable number of occurences can be done with re. How about # data = the string strings = [] for s in data.split('START')[1:]: strings.append(s.split('END')[0])
- Previous message (by thread): RE Help
- Next message (by thread): RE Help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list