Regexes: How to handle escaped characters

Torsten Bronger bronger at physik.rwth-aachen.de
Thu May 17 15:05:17 EDT 2007


Hallöchen!

I need some help with finding matches in a string that has some
characters which are marked as escaped (in a separate list of
indices).  Escaped means that they must not be part of any match.

My current approach is to look for matches in substrings with the
escaped characters as boundaries between the substrings.  However,
then ^ and $ in the patterns are treated wrongly.  (Although I use
startpos and endpos parameters for this and no slicing.)

Another idea was to have a special unicode character that never
takes part in a match.  The docs are not very promising regarding
such a thing, or did I miss something?

Any other ideas?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: bronger at jabber.org
                      (See http://ime.webhop.org for ICQ, MSN, etc.)



More information about the Python-list mailing list