I know there are a lot of regex threads out there by I need a specific pattern I couldn't fin anywhere
This regex validates in a YYYY-MM-DD format
/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/
I need the pattern to be DD/MM/YYYY (day first since it's in spanish and only "/", "-" should not be allowed)
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
(0[1-9]|[12][0-9]|3[01])[ \.-](0[1-9]|1[012])[ \.-](19|20|)\d\d
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
[...] },
"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..."[...]
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
Thanks a lot