Thursday, April 10, 2014

Understand Regex: "(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)[0-9]{2}"

"(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)[0-9]{2}"

Here
( ) - is first priority
[ ] - is like range of values you give to the character for which you have this [ ] tagged
|    - OR Symbol
{ } - number of times you wanted to see that charater for which you have { } tagged to
[-/_] - here the range of values that you give to the character are -, /, _.
so here
00/01/1900  --taking first valid option from given set
--
--
--
12_31_2099  -taking last valid option from given set

No comments:

Post a Comment