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

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

Re: Negate a regexp


From: Thierry Volpiatto
Subject: Re: Negate a regexp
Date: Mon, 19 Apr 2010 23:41:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Leo <address@hidden> writes:

> On 2010-04-19 18:54 +0100, Thierry Volpiatto wrote:
>> It will return \\coor because \ have to be escaped.
>>
>> (save-excursion (when (looking-back "^\\(\\\\[a-z]*\\)") (match-string 0)))
>>
>> It match on 1 also.
>
> This is a special case for the special example in my previous post.
>
> What about co\or ? It is still text contains word or symbol or \ (i.e.
> \sw \s_ or \s\).

Try to use the greedy arg:

try matching
\co\o_r-!-

(when (looking-back "\\([\\\\a-z_]*\\)" nil 'greedy) 
   (match-string-no-properties 0))

==>
"\\co\\o_r"

-- 
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/





reply via email to

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