Re: regular expression i'm going crazy

2011-05-16 Thread andy baxter
On 16/05/11 17:25, Tracubik wrote: pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? i want my re_s to find linka and la, he just find link and l and forget about the ending a. The round br

Re: regular expression i'm going crazy

2011-05-16 Thread Alexander Kapps
On 16.05.2011 18:25, Tracubik wrote: pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? As the docs say: "If one or more groups are present in the pattern, return a list of groups;" http

Re: regular expression i'm going crazy

2011-05-16 Thread Robert Kern
On 5/16/11 11:25 AM, Tracubik wrote: pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? i want my re_s to find linka and la, he just find link and l and forget about the ending a. can anyone

regular expression i'm going crazy

2011-05-16 Thread Tracubik
pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? i want my re_s to find linka and la, he just find link and l and forget about the ending a. can anyone help me? trying the regular expressio