Reputation: 15147
Just for curiosity.
Is it possible to create a regular expression that will not match any string, including an empty string?
Upvotes: 11
Views: 3165
Reputation: 116167
This regex should never match anything (provided you do not use single-line or multi-line modifiers):
$x^
Upvotes: 2
Reputation: 44326
Yes.
Here are a few examples.
.^
$.
(?!)
Naturally, there are an infinite number of such expressions.
Upvotes: 17