Help: Arbitrary number of groups in regex

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Thu Aug 8 17:01:45 EDT 2002


"Jean-Philippe Côté" <cotej at crt.umontreal.ca> writes:
> The way I undestand "(\w)*" is <<match a single alphanumeric
> character, put in into a group, return that group and repeat as
> long a you can>>, but that doesn't work:
> >>> m = re.match("(\w)*", "abcde")
> >>> m.groups()
> ('e',)
> >>>
> 
> Does anybody know what the PATTERN should be ?

That's not how regexps work.  You want re.split.



More information about the Python-list mailing list