Regular expression bug?

Ron Garret rNOSPAMon at
Thu Feb 19 22:06:32 CET 2009

In article <mailman.277.1235073073.11746.python-list at>,
 "andrew cooke" <andrew at> wrote:

> i wonder what fraction of people posting with "bug?" in their titles here
> actually find bugs?

IMHO it ought to be an invariant that len(r.split(s)) should always be 
one more than len(r.findall(s)).

> anyway, how about:
> re.findall('[A-Z]?[a-z]*', 'fooBarBaz')
> or
> re.findall('([A-Z][a-z]*|[a-z]+)', 'fooBarBaz')

That will do it.  Thanks!


More information about the Python-list mailing list