Am using it this way
function checkSyntax()
{
var value = '(1,0),(2,1),(3,1),(4,0)';
regex= /^(\(\d{1,3},[0-1]\)(,{0,1}))+$/;
var nArray = value.match(regex);
if (nArray==null)
alert("not a proper pattern"
else
alert("Proper pattern"
}
value can take (1,0),(2,1),(3,0)....
The problem with this code is it works fine even when i give (1,0),(2,0),
the pattern must not end with a comma..
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.