Help: Arbitrary number of groups in regex

Paul Rubin phr-n2002b at
Thu Aug 8 23:01:45 CEST 2002

"Jean-Philippe Côté" <cotej at> 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