string - Regex Persian Date validation -


i want regular expression validation persian date 1396/4/3, 1396/12/08 or else.
in other words, want ensure format of persian date (as string) thing these valid formats are:

1.yyyy/mm/dd

2.yyyy/mm/d

3.yyyy/m/dd

4.yyyy/m/d


any solution?

use regex:

^(\\d{4})/(0?[1-9]|1[012])/(0?[1-9]|[12][0-9]|3[01])$ 

with regex:

  • year 4 digits.
  • month smaller equal 12
  • day smaller equal 31

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -