寻找将匹配字符串开头的任何内容减去以下集合结尾之一的正则表达式:
_A
_B
_C
_ZZ
例如:
1. blah needs to match blah
2. blah_A needs to match blah
3. blahblah_A needs to match blahblah
4. blah_D needs to match blah_D
5. blah_Z needs to match blah_Z
6. blah_ZZ needs to match blah
7. blah_Ablah needs to match blah_Ablah
我尝试过的不成功尝试是:
.*(?=(_(A|B|C|ZZ)))
did not match 1,4,5, and 7 correctly
.*([^(_A$)]|[^(_B$)]|[^(_C$)]|[^(_ZZ$)])
did not match any correctly
使用的正则表达式版本是 javascript
有人有什么想法吗?