阅读背景:

仅当它与另一个正则表达式(Python)不匹配时才替换正则表达式

来源:互联网 

Long story short, I have two regex patterns. One pattern matches things that I want to replace, and the other pattern matches a special case of those patterns that should not be replace. For a simple example, imagine that the first one is "\{.*\}" and the second one is "\{\{.*\}\}". Then "{this}" should be replaced, but "{{this}}" should not. Is there an easy way to take a string and say "substitute all instances of the first string with "hello" so long as it is not matching the second string"?Long story short, I have two regex patterns. On




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: