<html> <head> <script> var p = /[a-z]/; function testMatch() { var str = document.getElementById("textfield").value; if (p.test(str)) { alert("The string \"" + str + "\" contains characters in range a-z."); } else { alert("The string \"" + str + "\" does not contain characters in range a-z."); } } </script> </head> <body> <h3> Checking the availability of characters in given range. </h3> Enter the String: <input type="text" id="textfield" /> <input type="button" value="Check" onclick="testMatch();" /> </body> </html>