[issue8185] re.findall()

2010-03-20 Thread Ezio Melotti
Ezio Melotti added the comment: What Jon said is correct, .group() is equivalent to .group(0) and returns the whole match. re.findall returns all the groups captured by each set of () as a list of strings (if there is 0 or 1 group) or a list of tuples (if there are more than 1). -- n

[issue8185] re.findall()

2010-03-20 Thread Jon Clements
Jon Clements added the comment: Seems consistent to me: .match, .search and .finditer return a MatchObject whose .group() return the *entire matched string*. If you use .group(1) you'll get similar results to .findall() which returns a list of (possibly of tuples) of the captured groupings.

[issue8185] re.findall()

2010-03-20 Thread Jean-Michel Fauth
New submission from Jean-Michel Fauth : >>> sys.version 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] >>> import re >>> re.match("[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?", "1.23e-4").group() 1.23e-4 >>> re.search("[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?", "1.23e-4").group(