Negative Lookahead work around for RE2 Syntax

浪尽此生 提交于 2020-08-09 04:57:17

问题


I was hoping to figure out how make re2 syntax work with a regular expression like the following:

(?!(support|help|admin|contact))@example\.com

Where you do not match on exactly those terms above.

For example, it should match:

test@example.com
hello@example.com

but not match:

support@example.com
help@example.com

i I cannot figure out a way for exactly those terms. I have seen a lot of work arounds where it requires you to test if it does match in golang/the re2 processer, and then return false. However this is not possible, because a service requires the regex, and I cannot ask it to alternate the match value.

Any ideas?

来源:https://stackoverflow.com/questions/54225052/negative-lookahead-work-around-for-re2-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!