validation - Regular Expression Validator for year in asp.net -
i have textbox has academic year input. can of format either 2013-14 or 2013-2014. how use regular expression validator this?
you can use regex
^(\d{4}-(\d{2}|\d{4}))$ and how use regex validator can see here
if want validate second year equal first plus 1 business logic, , should validated on server side, after regex validation passed on client side. example on client side can validate user enter correct format in input textbox regex above using validation not allow input incorrect string, after validation passed on server side can parse input string , validate logic second year should greater first
Comments
Post a Comment