Try your regular expression here
<html> <head> <title></title> <script type="text/javascript"> window.onload=setupEvents; function setupEvents(evnt) { document.someForm.onsubmit=validateField; } function validateField(evnt) { var rgEx = new RegExp(document.someForm.text1.value); var OK = rgEx.exec(document.someForm.text2.value); if (!OK) { alert("Not a match"); } else { alert("The Pattern matched!"); } return false; } </script> </head> <body> <form name="someForm"> Regular Expression: <input type="text" name="text1" /> <textarea name="text2" cols=50 rows=10></textarea> <input type="submit" value="Check RegExp" /> </form> </body> </html>