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

RegEx ??

former_member194669
Active Contributor
0 Likes
552

I am using the following pattern of RegEx for validating the date.

but it not giving proper result for Feb 31 date

p_regex = ' (0?[1-9]|[0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9] '

create object regex

exporting

pattern = p_regex

ignore_case = ''.

matcher = cl_abap_matcher=>create(

pattern = p_regex

ignore_case = ' '

table = i_files ).

Any Info?

a®

4 REPLIES 4
Read only

Former Member
0 Likes
521

Feb has only 28 days or 29(Leap year).

Might be this is the reason ...

Read only

0 Likes
521

Srinivas,

You didn't understand my question. in my question i mentioned that i am validating dates. ie i need to validate date from a file that contains dates say for example Feb 31

a®

Read only

0 Likes
521

Any help?

a®

Read only

0 Likes
521

Solved.

My RegEx was wrong. The RegEx mentioned in my question is will work fine with dd/mm/yyyy format. But date format is mm/dd/yyyy

Corect RegEx


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

a®