javascript - Test if string contains brackets with integer in it -
i want test if string in javascript contains normal brackets integer in it
var str="(12) test"; var pat=/(([\d]+))/; if (pat.test(str)) alert("true");
works fine, returns true when string looks this
var str="12) test"; var str="(12 test";
which should homecoming false.
escape brackets \
:
/\([\d]+\)/.test(str);
javascript regex
No comments:
Post a Comment