关键词:Regular Expression, RegExp, 正则表达式
工具
实例
匹配Id,但orderId和productId不算,必须包含其他的Id(包含orderId或productId也可以,但不能只有orderId或productId)
参考:http://stackoverflow.com/questions/1395177/regex-to-exclude-a-specific-string-constant
另一种解决方案
使用(?<!X),negative lookbehind
https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
http://www.rexegg.com/regex-lookarounds.html
另一个例子: