Re: Regexp and multiple groups (with repeats)

2009-11-20 Thread Mark Tolonen
"mk" wrote in message news:he60ha$iv...@ger.gmane.org... Hello, >>> r=re.compile(r'(?:[a-zA-Z]:)([\\/]\w+)+') >>> r.search(r'c:/tmp/spam/eggs').groups() ('/eggs',) Obviously, I would like to capture all groups: ('/tmp', '/spam', '/eggs') But it seems that re captures only the last group. Is

Re: Regexp and multiple groups (with repeats)

2009-11-20 Thread Neil Cerutti
On 2009-11-20, mk wrote: > Hello, > > >>> r=re.compile(r'(?:[a-zA-Z]:)([\\/]\w+)+') > > >>> r.search(r'c:/tmp/spam/eggs').groups() > ('/eggs',) > > Obviously, I would like to capture all groups: > ('/tmp', '/spam', '/eggs') You'll have to do something else, for example: >>> s = re.compile(r'(?:[

Regexp and multiple groups (with repeats)

2009-11-20 Thread mk
Hello, >>> r=re.compile(r'(?:[a-zA-Z]:)([\\/]\w+)+') >>> r.search(r'c:/tmp/spam/eggs').groups() ('/eggs',) Obviously, I would like to capture all groups: ('/tmp', '/spam', '/eggs') But it seems that re captures only the last group. Is there any way to capture all groups with repeat following