Regular Expression Non Capturing Grouping Does Not Work.

Miles Kaufmann milesck at umich.edu
Sat Jun 27 03:46:01 EDT 2009


On Jun 27, 2009, at 3:28 AM, Virtual Buddha wrote:

> Hello all,
>
> I am having some difficulties with the non-capturing grouping in
> python regular expression module.
>
> Even the code from the online documentation (http://docs.python.org/
> howto/regex.html#non-capturing-and-named-groups) does not seem to
> work.
>
> ...

Notice that you are calling .group() on the match object instead  
of .groups().  Without any arguments, .group() is equivalent  
to .group(0), which means "return the entire matching string."

http://docs.python.org/library/re.html#re.MatchObject.group

-Miles




More information about the Python-list mailing list