regex year

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I need to validate any year in format
05 and 2005 and not 200 or 005. I am currently using ^(\d{4})$.

Thanks
 
You can try

^(\d{2}){1,2}$

this regular expression accepts two or four numeric digits only.
 
Back
Top