Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.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_Regex Negation - Fatal编程技术网

Regex 包含一个表达式但不包含';不要控制对方

Regex 包含一个表达式但不包含';不要控制对方,regex,regex-negation,Regex,Regex Negation,我们目前正在匹配“服务中心*队列” 我想忽略“服务中心、侦察中心、死亡队列”的情况,但仍然匹配其他所有内容。 正则表达式是什么?此javascript解决方案提供了一个包含匹配项的数组 var myText = 'service_hub_anything_queue Add service_hub_scout_dead_queue something service_hub_someting_queue else'; var myMatches = myText.match(/service_h

我们目前正在匹配“服务中心*队列” 我想忽略“服务中心、侦察中心、死亡队列”的情况,但仍然匹配其他所有内容。
正则表达式是什么?

此javascript解决方案提供了一个包含匹配项的数组

var myText = 'service_hub_anything_queue Add service_hub_scout_dead_queue something service_hub_someting_queue else';
var myMatches = myText.match(/service_hub(?!_scout_dead_)\w+queue/g);
如果你对比赛后发生的事情很感兴趣

var mySplit = ('dummy'+myText).split(/service_hub(?!_scout_dead_)\w+queue/g).filter(function(txt,i) {return (i>0);})

我放置'dummy',然后过滤掉第一部分,使其在sting以有效标记开始时和不以有效标记开始时都能工作。

此javascript解决方案提供了一个包含匹配项的数组

var myText = 'service_hub_anything_queue Add service_hub_scout_dead_queue something service_hub_someting_queue else';
var myMatches = myText.match(/service_hub(?!_scout_dead_)\w+queue/g);
如果你对比赛后发生的事情很感兴趣

var mySplit = ('dummy'+myText).split(/service_hub(?!_scout_dead_)\w+queue/g).filter(function(txt,i) {return (i>0);})

我放置“dummy”,然后过滤掉第一个部分,使其在sting以有效标记开始时和不以有效标记开始时都能工作。

使用负回溯:
使用负回溯:
使用负回溯:
“service\u hub.*”(?使用负回溯。我假设你的意思是“service\u hub.*队列”?使用负前瞻。我假设你指的是“服务中心。*队列”?