Regexes: How to handle escaped characters

James Stroud jstroud at mbi.ucla.edu
Thu May 17 15:25:53 EDT 2007


Torsten Bronger wrote:
> 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.
> 

You should probably provide examples of what you are trying to do or you 
will likely get a lot of irrelevant answers.

James



More information about the Python-list mailing list