null bytes in re pattern
null bytes in re pattern - difference between 1.5.2 and 2.0?
Skip Montanaro skip at mojam.comWed Dec 13 22:12:21 EST 2000
- Previous message (by thread): Parsing Java source files in Python ?
- Next message (by thread): null bytes in re pattern - difference between 1.5.2 and 2.0?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): Parsing Java source files in Python ?
- Next message (by thread): null bytes in re pattern - difference between 1.5.2 and 2.0?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list