Q: Regex match everything except a given substring I know variations of this question have been asked in the past, but none of the examples I've tried out have been effective. So, one more time, how can I match all but a given substring with regex?
For example, select everything but stupid from this Einstein quote:
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

I've had some success capturing everything up to stupid using ((?!stupid).)*, but no luck with getting all of it. I've been testing with regex101.com

A: I would capture strings besides the stupid
like this:
^(.*)stupid(.*)$

and print( or do sth else; ) two times with \1 , \2 or $1 , $2...

anyway, is there any method that can capture non-connected strings at once?
