I know it is quite some weird goal here but for a quick and dirty fix for one of our system we do need to not filter any input and let the corruption go into the system.
A simple and cheap regex that will never match anything is to match against something that is simply unmatchable, for example: \b\B
.
It's simply impossible for this regex to match, since it's a contradiction.
\B
is the negated version of \b
. \B
matches at every position where \b
does not. Have you tried this simple regex? [^.]*
Another very well supported and fast pattern that would fail to match anything that is guaranteed to be constant time:
$unmatchable pattern
$anything goes here
etc.
$
of course indicates the end-of-line. No characters could possibly go after $
so no further state transitions could possibly be made. The additional advantage are that your pattern is intuitive, self-descriptive and readable as well!
You want to match nothing at all? Neg lookarounds seems obvious, but can be slow, perhaps ^$
(matches empty string only) as an alternative?