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


JAVASCRIPT TUTORIALS » Regular Expressions » Match »

 

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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Regular Expressions
» Match