Re: [Pyparsing] C++ Comments and a Backslash at the End of the Line.
Brought to you by:
ptmcg
From: Ralph C. <ra...@in...> - 2006-10-08 13:21:29
|
Hi Paul, > Care to try your hand at the re's for quoted strings? OK. _escapedChar = Regex(r"\\.") I don't think this is used anywhere? dblQuotedString = Regex(r'"([^"\n\r\\]|("")|(\\.))*"') There's not much you can do about this. Make it non-capturing. Other than that, attempting to match many [^"\n\r\\] at a time without going outside the group will result in exponential behaviour on an unterminated string because of backtracking. See http://www.regular-expressions.info/atomic.html Unfortunately, Python's re module doesn't support Atomic Grouping or Possessive Quantifiers, unlike, e.g. Perl. Cheers, Ralph. |