Regex 正则表达式:如何匹配不以前缀列表开头的子字符串

Regex 正则表达式:如何匹配不以前缀列表开头的子字符串,regex,list,prefix,Regex,List,Prefix,我需要替换字符串中的匹配词,但不包括这些词的前缀列表 The matchingWord should be replaced in the first line But excludePrefix1.matchingWord , not in this line Neither in this other line excludePrefix2.matchingWord But again in this allowedPrefix.matchingWord 我成功地使用了带有单个前缀的正则表

我需要替换字符串中的匹配词,但不包括这些词的前缀列表

The matchingWord should be replaced in the first line
But excludePrefix1.matchingWord , not in this line
Neither in this other line excludePrefix2.matchingWord
But again in this allowedPrefix.matchingWord
我成功地使用了带有单个前缀的正则表达式:

(?<!(excludePrefix1\.))matchingWord
但是,如果有几个排除在外的前缀,我怎么能做到这一点呢

我试过这样的东西:

(?<!((excludePrefix1\.)(excludePrefix2\.)))matchingWord

但这是行不通的,请一位正则表达式专家帮我们解决这个棘手的问题好吗?

在几种工具中,负回溯必须是固定长度的,对于您的问题,请使用多回溯:

(?<!excludePrefix1\.)(?<!excludePrefix2\.)matchingWord