30
rated 0 times
[
35]
[
5]
/ answers: 1 / hits: 37968
/ 11 Years ago, tue, january 7, 2014, 12:00:00
I am trying to validate textbox with valid datetime format. I need to check 24 hours datetime format. So i input following text to my textbox 22.05.2013 11:23:22
But it still doesnt validate it correctly. I am totally new to regex. This is so far i have tried
$('#test1').blur(function(){
var validTime = $(this).val().match(/^[0,1]?d/(([0-2]?d)|([3][01]))/((199d)|([2-9]d{3}))s[0-2]?[0-9]:[0-5][0-9]?$/);
debugger;
if (!validTime) {
$(this).val('').focus().css('background', '#fdd');
} else {
$(this).css('background', 'transparent');
}
});
This is my fiddle
More From » regex