在Geany中,正则表达式搜索中的负面观察是否可行?

Geany’s documentation on negative assertions让它看起来像是可能的.

作为参考,这是有效的,并给我结果:

pcregrep -r "(?<!= )function\(" src/main-js/

但同样的正则表达式,或任何具有负面背后的正则表达式,从Geany启动时都没有给我任何结果(v 1.24.1)

问题出在哪儿 ?文档错了吗?

精确度:主题不是关于如何避免背后的负面看法,而是关于如何做任何标准的PCRE负面看.

我得到了freenode上geany开发者的支持.很有帮助.这是他们告诉我的:

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

但是,在您尝试之后,您遇到了以下错误:

/bin/grep: conflicting matchers specified

…我被告知这是一个geany bug. Geany调用grep -E,-P与它不兼容.

您唯一的解决方法是让shell脚本使用-P而不是-E调用grep,并使用此脚本.您应该能够配置grep工具以调用geany首选项.

所述shell脚本的一个例子:

#!/bin/sh

matchopts=$(echo "$1" | tr E P)
shift

exec grep $matchopts "$@"

对于grep,Geany使用either -F or -E(这些是POSIX grep中唯一可用的引擎),因此为什么你不能传递-P.

我已经向geany开发者报告了the bug.

相关文章

jquery.validate使用攻略(表单校验) 目录 jquery.validate...
/\s+/g和/\s/g的区别 正则表达式/\s+/g...
自整理几个jquery.Validate验证正则: 1. 只能输入数字和字母...
this.optional(element)的用法 this.optional(element)是jqu...
jQuery.validate 表单动态验证 实际上jQuery.validate提供了...
自定义验证之这能输入数字(包括小数 负数 ) &lt;script ...