Regular expression that is false if it matches and true if it doesn't
10:28 09 Oct 2026

For a specific situation I need to build a regexp that does this:

It must search a given Text for the existence of a given string,

It must not return any match (i.e. logical false) if it finds the string at least once.

It must return one or more matches if it does not find the string.

I can do something like this:

/ig ^suchtext

it will match all lines that begin with the string "suchtext".

But if I do /ig ^(?!suchtext), it does not match any line even if there is lines that do not begin with suchtext.

Additionally it seems to have problems to parse correctly when there are "-"," " or/and ":" in the string it should search for. If I use the first regexp /ig ^suchtext and replace "suchtext" by e.g. "test: a-b-c" and I have a line that begins with that it will not match for some reason.

Does anyone have some tips for me?

regex regex-negation fortigate