Regex to match if string does not start with substring


I know that Go is handling regex a bit differently with lookahead so on. What I am trying to do is that, I want to match everything that DOESN’T start with Test_integration_. It is actually easy with ^(?!Test_integration_)\w+$ but not that easy with Go. How do I do this please?

Note: I don’t mind a solution that “doesn’t end with” if it is easier.


This is fine because it runs all tests that starts with Test_integration_.

go test -v -run Test_integration_ ./some/package/

This should run all tests excluding the ones mentioned above.

go test -v -run ????? ./some/package/


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.