Example:
/(?:Foo){0}bar/
I saw something like this in another answer. At first I thought "what should that be", but then, "OK could make sense, kind of a negative look behind", so that Foo
is not allowed before bar
, but this is not working.
You can see this here on Regexr: It matches only bar
but it matches also the bar
in Foobar
.
When I add an anchor for the start of the row:
/^(?:Foo){0}bar/
it behaves like I expect. It matches only the bar
and not the bar
in Foobar
.
But that's exactly the same behaviour as if I used only /bar/
or /^bar/
.
Is the quantifier {0}
only a useless side effect, or is there really a useful behaviour for that?