Wow, I've started to research RegExps for data verification...not a small topic.
Anyway, my sample script isn't working and I don't know why, can anyone help?
For this one, I'm looking to test whether a string is a time (ie; 11:45 am)
Why does this alert "false"?
function testField(fieldname){
var fieldval
fieldval = "12:36 pm"
var re = new RegExp( fieldval, '^([1-12]))([1-60])$' );
alert(re.test(fieldval))
}
Anyway, my sample script isn't working and I don't know why, can anyone help?
For this one, I'm looking to test whether a string is a time (ie; 11:45 am)
Why does this alert "false"?
function testField(fieldname){
var fieldval
fieldval = "12:36 pm"
var re = new RegExp( fieldval, '^([1-12]))([1-60])$' );
alert(re.test(fieldval))
}