How to match string that does not contain a specific string

Viewed 5760

I would like to write regexp in Go to match a string only if it does not contain a specific substring (-numinput) and contain another specific string (-setup).

Example, for inputStr

The following type of strings should NOT match because -numinput is present

str = "axxx yy  -setup  abc -numinput 12345678 aaa"

The following type of strings should match as -setup is present and -numinput is not present

str = "axxx yy  -setup  abc aaa"

The following type of strings should not match because -setup is not present even though -numinput is not present

str = "axxx yy abc aaa"

I came across some posts like Regular expression to match a line that doesn't contain a word?

But, I just dont understand how to do it in Golang

1 Answers
Related