You can never go down the drain...
Tim Peters
tim_one at email.msn.com
Mon Sep 25 21:32:46 EDT 2000
[/F posts a one-line patch to sre_parse.py]
[Philip]
> Thanks, but... EEEK!!
>
> If we could get all our heads out from under the hood for a moment,
There was nothing wrong with original regexp. That's why our heads are
under the hood.
> I feel compelled to restate my question. Is there any regular expression
> I can code besides this one that does what I was trying? The point of
> the exercize is to _not_ change the source of the package.
>
> assert ('Gold Man' == re.sub('([a-z])([A-Z])', r'\1 \2', 'GoldMan'))
Sure: change
r'\1 \2'
to
r'\1\040\2'
That worms around the bug under the hood without changing the source of the
package.
someday-you'll-think-regexps-are-really-boring<wink>-ly y'rs - tim
More information about the Python-list
mailing list