Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Why this result with the re module

Thread Tools

Why this result with the re module

Yingjie Lan
Posts: n/a
Hi, I am rather confused by these results below.
I am not a re expert at all. the module version
of re is 2.2.1 with python 3.1.2

>>> import re
>>> re.findall('.a.', 'Mary has a lamb') #OK

['Mar', 'has', ' a ', 'lam']
>>> re.findall('(.a.)*', 'Mary has a lamb') #??

['Mar', '', '', 'lam', '', '']
>>> re.findall('(.a.)+', 'Mary has a lamb') #??

['Mar', 'lam']

Thanks in advance for any comments.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Must be a bug in the re module [was: Why this result with the remodule] Yingjie Lan Python 0 11-03-2010 01:41 AM
simulation result is correct but synthesis result is not correct J.Ram VHDL 7 12-03-2008 01:26 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds Michael Tan Ruby 32 07-21-2005 03:23 PM