List Info

Thread: hilight -regexp: using zero-width negative look-ahead assertion?




hilight -regexp: using zero-width negative look-ahead assertion?
user name
2007-12-25 18:08:12
I would like to make a hilight that reacts on anything
containing
"foo", except when it is followed by
"bar".
For instance, "I pity the fool" should produce a
hilight, but "I pity
the foobar" not.
The normal way to do this in a perl regex is /foo(?!bar)/
(called a
"zero-width negative look-ahead assertion" in the
perlre manpage), but
if I use "/hilight -regexp foo(?!bar)", irssi says
that the regex is
"[INVALID!]"
So how do I use a ZWNLAA in irssi?


Re: hilight -regexp: using zero-width negative look-ahead assertion?
country flaguser name
United Kingdom
2007-12-26 02:42:21
On Dec 26, 2007 at 00:08, Alexander Thomas praised the
llamas by saying:
> I would like to make a hilight that reacts on anything
containing
> "foo", except when it is followed by
"bar".
> For instance, "I pity the fool" should
produce a hilight, but "I pity
> the foobar" not.
> The normal way to do this in a perl regex is
/foo(?!bar)/ (called a
> "zero-width negative look-ahead assertion" in
the perlre manpage), but
> if I use "/hilight -regexp foo(?!bar)", irssi
says that the regex is
> "[INVALID!]"
> So how do I use a ZWNLAA in irssi?
> 
Unfortunately, it looks like you can't. Irssi uses the POSIX
regex
library built into the libc library, which, as far as I'm
aware, doesn't
have these advanced features. I'm sure patches will be
welcome that make
use of PCRE if it is available.

-- 
David Pashley
daviddavidpashley.com
Nihil curo de ista tua stulta superstitione.


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )