P
Paul Keister
I'm currently using the following regular expression for U.S. date
validation:
\d{1,2}/\d{1,2}/\d{4}| \d{1,2}/\d{1,2}/\d{2}
I could have used
\d{1,2}/\d{1,2}/\d{2,4}
but that would allow the case of a three digit year (I wouldn't sleep at
night!).
My question is this: Why is it that when I use the inverse pattern, e.g.
\d{1,2}/\d{1,2}/\d{2}| \d{1,2}/\d{1,2}/\d{4}
that four digit date strings fail validation? I have a feeling this has
something to do with regex evaluation rules, but I can't quite puzzle it
out.
Just curious,
Paul Keister
PJPM
www.pjpm.biz
validation:
\d{1,2}/\d{1,2}/\d{4}| \d{1,2}/\d{1,2}/\d{2}
I could have used
\d{1,2}/\d{1,2}/\d{2,4}
but that would allow the case of a three digit year (I wouldn't sleep at
night!).
My question is this: Why is it that when I use the inverse pattern, e.g.
\d{1,2}/\d{1,2}/\d{2}| \d{1,2}/\d{1,2}/\d{4}
that four digit date strings fail validation? I have a feeling this has
something to do with regex evaluation rules, but I can't quite puzzle it
out.
Just curious,
Paul Keister
PJPM
www.pjpm.biz