Regular Expression Non Capturing Grouping Does Not Work.

Virtual Buddha virtualbuddha at gmail.com
Sat Jun 27 04:16:59 EDT 2009


> group != groups
>
> match.group() or match.group(0) gives you a special group that comprises the
> whole match. Regular capturing groups start at index 1, and only those are
> returned by match.groups():
>
> >> re.match("(?:[abc])+", "abc").group() # one group
> 'abc'
> >>> re.match("(?:[abc])+", "abc").groups() # all capturing groups
>
> ()
>
> Peter


Aaargh! Should have caught that myself. Sorry for wasting all your
time. Thank you Peter and Miles! (I am off to bed now. 4:10 am :)





More information about the Python-list mailing list