Regexes: How to handle escaped characters

John Machin sjmachin at lexicon.net
Thu May 17 19:12:53 EDT 2007


On May 18, 8:16 am, Paul McGuire <p... at austin.rr.com> wrote:
> On May 17, 4:06 pm, John Machin <sjmac... at lexicon.net> wrote:
>
>
>
> > On May 18, 6:00 am, Torsten Bronger <bron... at physik.rwth-aachen.de>
> > wrote:
>
> > > Hallöchen!
>
> > > James Stroud writes:
> > > > Torsten Bronger wrote:
>
> > > >> 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.

Note: "must not be *part of* any match" [my emphasis]

[big snip]
>
> Here are two pyparsing-based routines, guardedSearch and
> guardedSearchByColumn.  The first uses a pyparsing parse action to
> reject matches at a given string location

Seems to be somewhat less like what the OP might have in mind ...

While we're waiting for clarification from the OP, there's a chicken-
and-egg thought that's been nagging me: if the OP knows so much about
the searched string that he can specify offsets which search patterns
should not span, why does he still need to search it?

Cheers,
John




More information about the Python-list mailing list