Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with Sub matches - RegEx

former_member194669
Active Contributor
0 Likes
357

I am using the following RegEx for finding sub matches of a date. But the third sub match is giving only 2 characters.

Please find Regex i am using


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

and using date as 12/12/2008 , but in sub matches i am getting the values as 12 12 20

Any info?

I am using the following RegEx for finding sub matches of a date. But the third sub match is giving only 2 characters.

Please find Regex i am using


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

and using date as 12/12/2008 , but in sub matches i am getting the values as 12 12 20

Any info?

1 REPLY 1
Read only

former_member194669
Active Contributor
0 Likes
323

Solved. Regex submatch variable length problem