MasterMax1313
New Member
- Messages
- 84
- Reaction score
- 0
- Points
- 0
i have what seems to be a regex that should work, but isn't.
input : 00:05
result: one value of 00. i've tested it on another javascript regex evaluator site which seems to work fine with the result of 00 and 05.
any help would be appreciated.
edit:
I've managed to come up with another solution, with the help of a friend
Code:
var result = /[0-9]+/g.exec(enteredTime);
input : 00:05
result: one value of 00. i've tested it on another javascript regex evaluator site which seems to work fine with the result of 00 and 05.
any help would be appreciated.
edit:
I've managed to come up with another solution, with the help of a friend
Code:
var enteredTime = document.getElementById('Blind_Time').value;
var result = enteredTime.match(/^(\d\d):(\d\d)$/g);
if(result)
{
var result = enteredTime.match(/[0-9]+/g);
blind_hours = parseInt(result[0]);
blind_minutes = parseInt(result[1]);
time_to_next.setHours(blind_hours, blind_minutes, 0, 0);
}
else
{
alert("Time must be in the hh:mm format");
}
Last edited: