Regular Expressions in JavaScript

The following code demonstrates how to use regular expressions in JavaScript

<html>
<head>
<script type='text/javascript'>
function ValidateTime(input)
{
    var regex3 = /^(1[0-2]|\d)\:\d{2}\s{0,}[APap][Mm]$/;
    return input.match(regex3);
}
function input_click()
{
    var input = document.getElementById('input').value;
    if (ValidateTime(input))
        alert('[' + input + '] is a valid time');
    else
        alert('[' + input + '] is NOT a valid time');
}
</script>
</head>
<body>
Start Time: <input type='input' id='input' />
<br/>
<input type='submit' value='Test' onclick='input_click();' />
</body>
</html>