On Fri, 16 Feb 2007 06:19:42 -0800, Shawn Betts sabetts@vcn.bc.ca wrote:
Edi Weitz edi@agharta.de writes:
If you really need it, you could loop through the string applying SCAN until it matches with decreasing values for START, but that could be quite inefficient, of course. An alternative would be to work on (REVERSE TARGET) instead of TARGET, but you'll have to think hard how your regular expression should look like in that case - the semantics of things like "*" will certainly be different.
I was afaid you'd say that :). I guess I'll look closer into how emacs does it.
Of course, if you're really adventurous, you could look at the source code of CREATE-SCANNER-AUX in CL-PPCRE and think about efficient variants of ADVANCE-FN for searching backwards. My guess (from looking at the Emacs C code for two minutes) is that this is more or less what Emacs is doing as well.