Javascript regular expression: [a-e] |
<input type="button" value="Match" onclick="javascript:demo('abefg');return false;" /> <input type="button" value="No Match" onclick="javascript:demo('abpfg');return false;" /> <script type="text/javascript" language="JavaScript"> //<![CDATA[ function demo(text) { var re = /ab[c-e]fg/; if (text.match(re)) { alert("match"); } else { alert("no match"); } } //]]> </script> |