Regular expression bug?
rNOSPAMon at flownet.com
Thu Feb 19 22:06:32 CET 2009
In article <mailman.277.1235073073.11746.python-list at python.org>,
"andrew cooke" <andrew at acooke.org> 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')
> re.findall('([A-Z][a-z]*|[a-z]+)', 'fooBarBaz')
That will do it. Thanks!
More information about the Python-list