Javascript date regex DD/MM/YYYY -


I know that there are many reged threads, I need a special pattern that I can not locate anywhere < / P>

This regex is valid in a YYYY-MM-DD format

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

Required DD / MM / YYYY (day before it is in Spanish and should not be allowed only "/", "-")

I have discovered many reggae libraries And I think this should work ... but since then I am not familiar with regex. I'm not sure that it confirms that

  (0 [1-9] | [ 12] [0-9] | 3 [01]) [\ .-] (0 [1-9] | 1 [012]) [\ .-] (19 | 20 |) \ d \ d   

I do not even know to avoid slash, I try to "see" the argument in the string but it is my attempt to "see" the matrix code. I put the regex string in an option I am Js

  [...]}, "Date": {"regex": (0 [1-9] | [12] [0-9] | 3 [01]) [ "[Alert Test AAAAA-MM-DD"], "Alert Test", " Other types ... "[...]   

So, if regex is OK, how do I save it? If it is not, then what is the correct regex and how can I save it? : P

Thank you very much

I will call this function in DD / MM / Yyyy Format: ("3/9/2013") from

  // (new date): 3 September // (new date ()). From the string ("3/9/2013", false): Date of March 9. Protopp.from string = function (str, ddmmyyyy) {var m = str.match (/ (\ | d +) (- | \ /) (\ d +) (? :: (? :: (\ d +)) ? (?.: \ (\ D +)) | \ /) (:: (\ d +) \ s + (\ d +) (\ d +)) /); If (m [2] == "/") {if (ddmmyyyy === false) new date (+ m [4], + m [1] -1, + m [3], m [5] ? + M [5]: 0, m [6]: m [0], m [7]? + M [7]: 0, m [8]? + M [8] * 100: 0); Returns new date (+ m [4], + m [3] - 1, + m [1], me [5]? M [5]: 0, m [6]? + M [6]: 0, m [7]? + [7]: 0, m [8]? + M [8] * 100: 0); } New date of return (+ m [1], + m [3] - 1, + m [4], m [5]? M [5]: 0, m [6]? + M [6]: 0, m [7]? M [7]: 0, m [8]? + M [8] * 100: 0); }    

Comments