Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 升华文本正则表达式仅在未转义时工作_Regex_Sublimetext3_Sublimetext_Regex Lookarounds - Fatal编程技术网

Regex 升华文本正则表达式仅在未转义时工作

Regex 升华文本正则表达式仅在未转义时工作,regex,sublimetext3,sublimetext,regex-lookarounds,Regex,Sublimetext3,Sublimetext,Regex Lookarounds,在升华文本3中,为什么这与3个条目匹配 \$http\.post\('\/((?!view|list).)[^\']*' 但这一点都不匹配 \$http\.post\('\/((?!view|list).)[^\']*\' 在以下数据集上 $http.post('/listSets' ,$scope.updateAccessKey({type: 2}), { $http.post('/viewedMessage' , viewedMessagePayload, { $http.post('/

在升华文本3中,为什么这与3个条目匹配

\$http\.post\('\/((?!view|list).)[^\']*'
但这一点都不匹配

\$http\.post\('\/((?!view|list).)[^\']*\'
在以下数据集上

$http.post('/listSets' ,$scope.updateAccessKey({type: 2}), {
$http.post('/viewedMessage' , viewedMessagePayload, {
$http.post('/listRelatedContent' , 
$http.post('/viewedSet' , payLoad , {
$http.post('/viewDiscussion' , payLoad , {
$http.post('/editMessage' , $scope.updateAccessKey(payLoad), {
$http.post('/addComment' , $scope.updateAccessKey(payLoad), {
$http.post('/createStudySet' , createSetP
我知道转义撇号是可选的,但为什么它会破坏升华文本正则表达式搜索?

根据,升华内部使用Boost PCRE引擎为搜索面板中的正则表达式提供动力,并且根据,构造
\'
\z
同义,只在缓冲区的末尾匹配

因此,以
\'
结尾的正则表达式的版本与任何内容都不匹配,因为根据定义,它只与出现在文件最后一行的
$http.post
行匹配,该行以URL字符串仍然未终止的文件结尾

由于正则表达式中
*
之前的
\'
,它将匹配该行后面的任意数量的文本,只要它不包含单个引号(由于字符类中的排除)

例如,给定以下输入,您的正则表达式将匹配最后一个
$http.post
,包括它后面一直到缓冲区末尾的所有内容

$http.post('/listSets' ,$scope.updateAccessKey({type: 2}), {
$http.post('/viewedMessage' , viewedMessagePayload, {
$http.post('/listRelatedContent' , 
$http.post('/viewedSet' , payLoad , {
$http.post('/viewDiscussion' , payLoad , {
$http.post('/editMessage' , $scope.updateAccessKey(payLoad), {
$http.post('/addComment' , $scope.updateAccessKey(payLoad), {
$http.post('/createStudySet , $scope.updateAccessKey(payLoad), {

And then some other non code stuff here.
Basically anything but a single quote.

SublimiteText2使用Boost。SublimiteText3使用成熟的PCRE正则表达式引擎。运行
overgrow(*SKIP)(*F)grow
regex over
grow grow overgrow
,您将看到它是有效的(Boost不支持PCRE动词)。@WiktorStribiżew查看Boost支持的(如答案中所链接的)
SKIP
FAIL
,尽管Boost并不支持所有控件动词,如
MARK
。实际上,
MARK
(使用中的示例)在ST3中不起作用,因此它看起来确实使用了Boost-您是否有任何其他证据支持ST3不使用Boost的概念?SublimiteText2不支持
(*跳过)(*失败)
。使用Boost的记事本++不支持
(*跳过)(*失败)
。关键是SublimiteText3现在使用PCRE。即使只是测试
]
(或
}
),您也可能会发现差异-在SublimiteText2中,字符必须在字符类之外转义,而在SublimiteText3中,这是不必要的(在PCRE中是正确的)。