var name ='John Rock';
alert((/^John|Steve$/i).test(name));
This code alerts true
, because doesn't use an exact mathing, but has to.
Should return true
for John
and joHn
(case matching off). But not for John 12
or mahjohng
.
There is |
in the code, we should keep it.
How do I fix this regexp?