null bytes in re pattern - difference between 1.5.2 and 2.0?
Skip Montanaro
skip at mojam.com
Wed Dec 13 22:12:21 EST 2000
I want to delete control characters from some strings. Accordingly, I
tried:
name = re.sub("[\000-\037\177]", "", name)
This works in Python 2.0 but not in 1.5.2. In 1.5.2 I find I need to use
raw strings:
name = re.sub(r"[\000-\037\177]", "", name)
Accordingly, using raw strings in 2.0 fails. Is there some form that will
work both in 1.5.2 and 2.0?
Is this a change I should have expected? I assume it has something to do
with Unicode support in 2.0.
--
Skip Montanaro (skip at mojam.com)
Support the Mojam.com Affiliates Program: http://www.mojam.com/affl/
(847)971-7098
More information about the Python-list
mailing list