[Pyparsing] matching a previous match
Brought to you by:
ptmcg
From: Waylan L. <wa...@gm...> - 2007-01-25 16:59:48
|
I'm trying to match an string enclosed in backticks. Rather than using an escape character, the string is simply wrapped in more backticks. Here are some examples: `foo` => foo ``foo`bar`` => foo`bar `` `bar` `` => `bar` #note the spaces in this one This is easy in regex: (?P<backtick>`+)(?P<string>.*?)(?P=backtick) Of course, the trick is that the ending string of backticks must exactly match the opening string of backticks. Sure I can use Regex() for this, but I'm trying to figure you how to do that without regex. How can I refer back to a previous match? -- ---- Waylan Limberg wa...@gm... |