Wednesday, 11 September 2013

Error with the limiter {} in regexp

Error with the limiter {} in regexp

Hey guys I have a problem! I want to make a reg exp for this: J-XXXXXXXX-X
(where X are numbers), what I've done is:
if (rif.match("^ (j | J) (-) ([0-9] {8}) (-) ([0-9] {1}) $")) {
alert("OK");
} else {
alert("OK");
}
but does not work, because when you place a data field to "1", it does
nothing.
looking at the code it shows me google chrome (see source code), I watch
this:
if (rif.match("^ (j | J) (-) ([0-9]) (-) ([0-9]) $")) {
alert("OK");
} else {
alert("OK");
}
and I can not see the "{8}" that each Regular expression, what's happening?

No comments:

Post a Comment