Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5524

regular expression i'm going crazy

From Tracubik <affdfsdfdsfsd@b.com>
Subject regular expression i'm going crazy
Newsgroups comp.lang.python
Date 2011-05-16 16:25 +0000
Message-ID <4dd14fdb$0$18238$4fafbaef@reader2.news.tin.it> (permalink)
Organization TIN.IT (http://www.tin.it)

Show all headers | View raw


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 expression in redemo.py (program 
provided with python to explore the use of regular expression) i get what 
i want, so i guess re_s is ok, but it still fail...
why?
help!

Nico

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

regular expression i'm going crazy Tracubik <affdfsdfdsfsd@b.com> - 2011-05-16 16:25 +0000
  Re: regular expression i'm going crazy Robert Kern <robert.kern@gmail.com> - 2011-05-16 11:51 -0500
  Re: regular expression i'm going crazy Alexander Kapps <alex.kapps@web.de> - 2011-05-16 19:01 +0200
  Re: regular expression i'm going crazy andy baxter <andy@earthsong.free-online.co.uk> - 2011-05-16 18:11 +0100

csiph-web