help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compilation-error-regexp-alist syntax problems


From: Stefan Monnier
Subject: Re: compilation-error-regexp-alist syntax problems
Date: Mon, 02 Feb 2004 17:02:12 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>         (cons '("\\[javac\\] *\(/[^:]+\):\([^:]*\):" 1 2) 
> compilation-error-regexp-alist)
                                \\(    \\) \\(   \\)

The regexp is written as a string.  \ is both a string and
a regexp operator.  When you write \n in a string it is turned into
linefeed char.  When you write \( it is turned into an open paren
(i.e. just as if there was no backslash), when you write \\ it is turned
into a single backslash.  To pass \( to the regexp engine, you have thus to
write \\ for the backslash and ( or \( for the open-paren.

When entering a regexp interactively in C-u C-s (for example), it's
different because it is not written as an elisp string so the quoting is
unnecessary.


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]