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

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

Re: does emacs regular expression support (?!expression)


From: Tassilo Horn
Subject: Re: does emacs regular expression support (?!expression)
Date: Thu, 02 Feb 2012 22:45:04 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux)

Tim Landscheidt <tim@tim-landscheidt.de> writes:

Hi Tim,

>> It would be more helpful if you'd tell us what (?!expression) would
>> match, preferably with some examples.  Syntactically, emacs regexp's shy
>> groups look similar.  The regular expression
>
>>   "\\(:?foo\\|bar\\)\\([0-9]+\\)"

BTW, that should have been (?:...).

>> matches "foo19" or "bar23", but doesn't capture foo or bar, so that
>> (match-string 1) is the number.
>
> In Perl, "(?!pattern)" is a zero-width negative look-ahead
> assertion.  Emacs does not support these AFAIK.

I see.  So when you do /foo(?!bar)/ in Perl, you'd need to do
"foo\\(?:[^b][^a][^r]\\)" in elisp.

Bye,
Tassilo




reply via email to

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