Reputation: 485
I have this very nice regex that I got from the net which makes my date inputs dd/MM/yyyy
, but now I would like to get it to only be ddMMyyyy
, but I can't seem to get the /
removed. Any help would be greatly apreciated.
(((((0[1-9])|(1\d)|(2[0-8]))\/((0[1-9])|(1[0-2])))|((31\/((0[13578])|(1[02])))|((29|30)\/((0[1,3-9])|(1[0-2])))))\/((20[0-9][0-9])|(19[0-9][0-9])))|((29\/02\/(19|20)(([02468][048])|([13579][26]))))
Upvotes: 0
Views: 267
Reputation: 2468
When removing instances of /, make sure you also remove the accompanying \ which is used for escaping.
Upvotes: 1
Reputation: 1808
Try this:
(((((0[1-9])|(1\d)|(2[0-8]))((0[1-9])|(1[0-2])))|((31((0[13578])|(1[02])))|((29|30)((0[1,3-9])|(1[0-2])))))((20[0-9][0-9])|(19[0-9][0-9])))|((2902(19|20)(([02468][048])|([13579][26]))))
Upvotes: 3