On Friday 21 September 2007, [EMAIL PROTECTED] 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])
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to