本文介绍了出生日期验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用相同的文本框来输入出生日期和年龄,即,如果一个人知道dob,他就输入dob;如果不知道dob,则他要输入年龄.因此,我需要使用正则表达式来验证我的文本框,以便一个人可以以dd/mm/yyyy格式或不超过3位数字的年龄输入日期..请使用正则表达式或其他任何方法来帮助我验证我的文本框

Hi i need to use same textbox for inserting date of birth and age ie if a person knows dob he enters dob and if dob is unknown he enters age . So I need to validate my textbox using regular expression so a person can enter date in dd/mm/yyyy format or upto 3 digit age ..Please help me to validate my textbox either using regular expression or anything else

推荐答案

^((?<day>\d{1,2})/(?<month>\d{1,2})/(?<year>(?:\d{4}|\d{2}))|(?<age>\d{1,3}))



除了我?我会使用两个控件和一个单选按钮.其中一个控件将是日期选择器.

[Edit]系统添加了虚假的结束标签-OriginalGriff [/Edit]


But me? I''d use two controls, and a radio button. And one of the controls would be a date picker.

System added spurious closing tags - OriginalGriff[/Edit]



这篇关于出生日期验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 06:05