Celeb Glow
news | March 03, 2026

regex match string that does not contain substr and case insensitive

I have a a string like maxreheattemp. I want my regex test to fail when the substring reheat is in it. I can do that with

^((?!reheat).)*$

but I also want my test to be case insensitive. I usually use (?i) for that, but can't find a way to combine the two so that maxReHeattemp also fails.

How do I do that?

1 Answer

With PCRE engine, you can do:

^(?i)((?!reheat).)*$

Demo & explanation

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy