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