Javascript regular expression: \d |
<input type="button" value="Match" onclick="javascript:demo('123');return false;" /> <input type="button" value="No Match" onclick="javascript:demo('abc');return false;" /> <script type="text/javascript" language="JavaScript"> //<![CDATA[ function demo(text) { var re = /\d/; if (text.match(re)) { alert("match"); } else { alert("no match"); } } //]]> </script> |