Listing C
<script language="javascript">
// the string we are going to operate on
var inputstr="A1234";
// our Regular Expression
var regex=/^[A-Z]\d{4}$/g;
// do the comparison, if we have a match
if (regex.test(inputstr))
{
alert("Matches");
}
else
{
alert("Does not match");
}
</script>