Re: [Tutor] Re.findall question

2012-06-26 Thread Alan Gauld
On 26/06/12 23:30, Alexander Quest wrote: My question is how does Python know to return just the part in the parentheses and not to return the "blahblah" and the "yattayattayatta", etc...? If you want to know *how* Python does it you will have to read the module code (probably in C so downloa

[Tutor] Re.findall question

2012-06-26 Thread Alexander Quest
I'm a bit confused about extracting data using re.search or re.findall. Say I have the following code: tuples = re.findall(r'blahblah(\d+)yattayattayatta(\w+)moreblahblahblah(\w+)over', text) So I'm looking for that string in 'text', and I intend to extract the parts which have parentheses around