Are negative lookbehind in regex searches possible in Geany?
I got support from the Geany developers on Freenode, and it was very helpful. Here is what they told me:
The documented RE syntax only applies to the RE engine directly used by Geany (e.g. in Find), but the Find in Files features calls the grep tool (as configured in preferences->tools->grep), which has its own syntax. For GNU grep, you can add "-P" to the "Extra options" field in the dialog
However, after you tried it, you had this error:
/bin/grep: conflicting matchers specified
... to which I was told this was a Geany bug. Geany calls grep -E
, and -P
is not compatible with it.
Your only workaround is to have a shell script calling grep with -P
instead of -E
, and use this script. You should be able to configure the grep tool to call in Geany preferences.
An example of said shell script:
#!/bin/sh
matchopts=$(echo "$1" | tr E P)
shift
exec grep $matchopts "$@"
Geany uses either -F
or -E
(these are the only available engines in POSIX grep) for grep, hence why you can't pass -P
.
I've reported the bug to the Geany developers.