Regular Expression Non Capturing Grouping Does Not Work.

Virtual Buddha virtualbuddha at gmail.com
Sat Jun 27 10:16:59 CEST 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