搜索源文本:

/russia/moscow-region/moscow/mitino_m
/russia/moscow-region/moscow/planernaya_m
/russia/moscow-region/outside
/russia/moscow-region/moscow/otradnoe_m
/russia/moscow-region/outside/podol-sk
/russia/moscow-region/foreign/mexico
/russia/moscow-region/moscow
/russia/moscow-region/abrakadabra/u-lalala
/russia/moscow-region/outside/himki
/russia/moscow-region/moscow/preobrajenskaya_pl_m


正则表达式在这里:

russia/moscow-region/(moscow|outside).*$


您可以在这里看到结果:http://www.myregextester.com/?r=7f93ce7f

我需要反转此表达式以匹配“ russia / moscow-region /”字符串值后不包含单词moscow, outside的所有值。怎么改变呢?

最佳答案

分组为NOT:

russia/moscow-region/(?!(moscow|outside)).*

09-26 16:37