问题
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