Matching sequences of more than one literal character (The format is two upper case letters, a dash and three numbers) : Match : Regular Expressions
JAVASCRIPT TUTORIALS
Matching sequences of more than one literal character (The format is two upper case letters, a dash and three numbers)
<html> <head> <title>Matching sequences of more than one literal character (The format is two upper case letters, a dash and three numbers)</title> <script type="text/javascript" language="javascript"> <!-- // function IsMatchingCode(str){ var myRegExp = /[A-Z]{2}-[0-9]{3}/ ; return myRegExp.test(str) }
function TestGuess(){ alert(IsMatchingCode("asdf")); } // --> </script> </head> <body> <h3>This page allows you to choose a six character parts code</h3> <form> <button type="Button" onclick="TestGuess()">Click here to guess</button> </form> </body> </html>