我正在寻找一个正则表达式来替换括号中的所有术语,除非括号在方括号内。
例如:
然而,这仍然会匹配方括号内的单词。
我还创建了一个rubular页面来展示我的进展: http://rubular.com/r/gG22pFk2Ld
例如:
(matches) #match
[(do not match)] #should not match
[[does (not match)]] #should not match
我现在有:
[^\]]\([^()]*\) #Not a square bracket, an opening bracket, any non-bracket character and a closing bracket.
然而,这仍然会匹配方括号内的单词。
我还创建了一个rubular页面来展示我的进展: http://rubular.com/r/gG22pFk2Ld