我如何使用正则表达式为Dd / Mm / Yyyy [英] How To I Do Use Regex For Dd/Mm/Yyyy
本文介绍了我如何使用正则表达式为Dd / Mm / Yyyy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试过这个但没用。请帮助
正则表达式中的语法错误。
/ ^ [1-9] | 1 [0-9] | 2 [0-9] | 3 [0-1] [/。 - ] [1-9] | 0 [1-9] | 1 [0-2] [/。 - ] 1 [8] [0-9] [0-9] | 2 [0] [0-9] [0-9] * $ /;
/ ^(0 [1-9] | [12] [0-9] | 3 [01])[/。 - ](0 [1-9] | 1 [012])[/。 - ](19 | 20)\d\d * /;
I have try this but no use.Kindly help
Syntax Error in Regular Expression.
/^[1-9]|1[0-9]|2[0-9]|3[0-1][/ . -][1-9]|0[1-9]|1[0-2][/ . -]1[8][0-9][0-9]|2[0][0-9][0-9]*$/;
/^(0[1-9]|[12][0-9]|3[01])[/ . -](0[1-9]|1[012])[/ . -](19|20)\d\d*/;
var regExpDateofBirth = /^(0[1-9]|[12][0-9]|3[01])[/ . -](0[1-9]|1[012])[/ . -](19|20)\d\d*/;
if (!regExpDateofBirth.test($('#txtDOB').val())) {
alert("Textbox value must be in YY/MM/DD.. Format ");
return false;
}
谢谢
Harshal Raut
Thanks
Harshal Raut
推荐答案
/;
/ ^(0 [1-9] | [12] [0-9] | 3 [01])[/。 - ](0 [1-9] | 1 [012])[/。 - ](19 | 20)\d\d * /;
/;
/^(0[1-9]|[12][0-9]|3[01])[/ . -](0[1-9]|1[012])[/ . -](19|20)\d\d*/;
var regExpDateofBirth = /^(0[1-9]|[12][0-9]|3[01])[/ . -](0[1-9]|1[012])[/ . -](19|20)\d\d*/;
if (!regExpDateofBirth.test(
('' #txtDOB')。val())){
alert( 文本框值必须为YY / MM / DD格式);
return false ;
}
('#txtDOB').val())) { alert("Textbox value must be in YY/MM/DD.. Format "); return false; }
谢谢
Harshal Raut
Thanks
Harshal Raut
试试这个:
Ask Google [ ^ ]
这篇关于我如何使用正则表达式为Dd / Mm / Yyyy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文