Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #A(?:(?:(?:(?:0?[13578])|(1[02]))/31/(19|20)?dd)|(?:(?:(?:0?[13-9])|(?:1[0-2]))/(?:29|30)/(?:19|20)?dd)|(?:0?2/29/(?:19|20)(?:(?:[02468][048])|(?:[13579][26])))|(?:(?:(?:0?[1-9])|(?:1[0-2]))/(?:(?:0?[1-9])|(?:1d)|(?:2[0-8]))/(?:19|20)?dd))Z#
- A # start of string
- (?: # group without capture
- # that match 31st of month 1,3,5,7,8,10,12
- (?: # group without capture
- (?: # group without capture
- (?: # group without capture
- 0? # number 0 optionnal
- [13578] # one digit either 1,3,5,7 or 8
- ) # end group
- | # alternative
- (1[02]) # 1 followed by 0 or 2
- ) # end group
- / # slash
- 31 # number 31
- / # slash
- (19|20)? #numbers 19 or 20 optionnal
- dd # 2 digits from 00 to 99
- ) # end group
- |
- (?:(?:(?:0?[13-9])|(?:1[0-2]))/(?:29|30)/(?:19|20)?dd)
- |
- (?:0?2/29/(?:19|20)(?:(?:[02468][048])|(?:[13579][26])))
- |
- (?:(?:(?:0?[1-9])|(?:1[0-2]))/(?:(?:0?[1-9])|(?:1d)|(?:2[0-8]))/(?:19|20)?dd)
- )
- Z
- require 'date'
- def valid_date?( str, format="%m/%d/%Y" )
- Date.strptime(str,format) rescue false
- end
- [0-1][0-9]/[0-3][0-9]/[0-9]{2}(?:[0-9]{2})?
- (?:(09|04|06|11)(/|-|.)(0[1-9]|[12]d|30)(/|-|.)((?:19|20)dd))|(?:(01|03|05|07|08|10|12)(/|-|.)(0[1-9]|[12]d|3[01])(/|-|.)((?:19|20)dd))|(?:02(/|-|.)(?:(?:(0[1-9]|1d|2[0-8])(/|-|.)((?:19|20)dd))|(?:(29)(/|-|.)((?:(?:19|20)(?:04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))|2000))))
- ^((0?1?1){1}|(0?1?2){1}|([0]?3|4|5|6|7|8|9))/((0?1?2?3?1){1}|(0?1?2?(2|3|4|5|6|7|8|9|0))|(30))/[1-90]{4}$
Add Comment
Please, Sign In to add comment