title: Javascript date regex DD/MM/YYYY
body: <p>I know there are a lot of regex threads out there by I need a specific pattern I couldn't fin anywhere </p>
  
  <p>This regex validates in a YYYY-MM-DD format </p>
  
  <pre><code>/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/
  </code></pre>
  
  <p>I need the pattern to be DD/MM/YYYY
  (day first since it's in spanish and only "/", "-" should not be allowed)</p>
  
  <p>I searched several regex libraries and I think this one should work... but since I'm not familiar with regex I'm not sure it validates like that</p>
  
  <pre><code>(0[1-9]|[12][0-9]|3[01])[ \.-](0[1-9]|1[012])[ \.-](19|20|)\d\d
  </code></pre>
  
  <p>I also don't know ho to escape the slashes, I try to "see" the logic in the string but it's like trying "see" the Matrix code for me. I'm placing the regex string in a options .js</p>
  
  <pre><code>[...]  },
  "date": {
                      "regex": (0[1-9]|[12][0-9]|3[01])[ \.-](0[1-9]|1[012])[ \.-](19|20|)\d\d,
                      "alertText": "Alert text AAAA-MM-DD"
                  },
  "other type..."[...]
  </code></pre>
  
  <p>So, if the regex is ok, how would I escape it? 
  if it's not, what's the correct regex and how do I escape it? :P</p>
  
  <p>Thanks a lot</p>