[lug] XEmacs quoting madness!

Tkil tkil at scrye.com
Mon Aug 20 15:50:59 MDT 2001


>>>>> "Tom" == Tom Tromey <tromey at redhat.com> writes:

Tom> For instance in Perl you simply use `(.|.)' to do submatches with
Tom> alternation.  In Emacs you must use `\(.\|.\)' -- thus requiring
Tom> extra quoting for the backslashes.  Worse, Emacs functions like
Tom> query-replace-regexp expose this to the user.

hm.  well, parentheses are overloaded no matter what: they show up in
code a lot, and they are used for submatches.  the user would have to
backwhack them in at least one of these cases; emacs only stands out
because it chose differently from most other implementations.

then again, there's probably some influence from lisp in there --
parens are so common that you want to be able to search for them
easily (especially lisp-ish function calls).  not sure if there's any
documented justificiation for this decision, however.

i find that switching between the different "roughly equivalent"
subsets of regex functionality to be not too difficult (egrep, awk,
emacs, perl).  i happen to know the perl quoting rules rather better
than those for the other tools, so i tend to rely on perl more often
than not.  

there are also some things that perl regexes can do that the others
can't, but i don't use those too often.  of these, i do occasionally
use the non-saving grouping operator in perl regexes.  this allows you
to have a group for constructing the regexps, but you don't save it
for later use.  it's the (?:...) bit; perldoc perlre.  i haven't
really found too much of a need for the other extensions, like look-
aheads and such.

t.




More information about the LUG mailing list