Re: [gedit-list] gedit gtksourceview regex flavour?



Hi Sebastien,
     Thanks for your reply. I had seen the second link, which seems to suggest I can use lookbehinds: "Lookbehind assertions start with (?<= for positive assertions and (?<! for negative assertions". PCRE definitely allows them as per the manual http://www.pcre.org/pcre.txt . However in practice it doesn't seem to work. I can use lookaheads: e.g if I make a rule like this in C.lang

    <context id="myregex" style-ref="myregexstyle">
        <match>foo(?=bar)</match>
    </context>

then apply a light blue colour, it results in this:

http://i.imgur.com/RtdVtrm.png

But if I try to use a lookbehind like this:

    <context id="myregex" style-ref="myregexstyle">
        <match>(?<=foo)bar</match>
    </context>

It doesn't work and breaks all the other colours:

http://i.imgur.com/ThKBFsX.png

which is quite strange! Best,
Brock

> Subject: Re: [gedit-list] gedit gtksourceview regex flavour?
> From: swilmet gnome org
> To: brock hotmail co uk
> CC: gedit-list gnome org
> Date: Wed, 25 Jun 2014 23:24:15 +0200
>
> Hi,
>
> See the tag <define-regex> at:
> https://developer.gnome.org/gtksourceview/stable/lang-reference.html
>
> It uses the PCRE regex syntax. See:
> https://developer.gnome.org/glib/stable/glib-regex-syntax.html
>
> Best regards,
> Sébastien
>





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