Just for curiosity.
Is it possible to create a regular expression that will not match any string, including an empty string?
Just for curiosity.
Is it possible to create a regular expression that will not match any string, including an empty string?
Yes.
Here are a few examples.
.^
$.
(?!)
Naturally, there are an infinite number of such expressions.
This regex should never match anything (provided you do not use single-line or multi-line modifiers):
$x^
How about /^$x/.
When I try it with ruby, it seems to work.