2008 Jul 01 3:16 PM
Hi
I need to search for a date range in the format DD.MM.YYYY-DD.MM.YYYY in some text such as:
Electricity Charges on 12.11.2001 to 12.12.2001.
How would I extract that date range without using offsets as the date range could equally be like this:
12.11.2001 to 12.12.2001 Electricity Charges.
I am thinking of using regular expressions. Would this be the right way to go? I have never used them before are they simple to use?
Cheers
Ian
2008 Jul 01 3:25 PM
Hi,
Try to use this logic:
data: txt type string value 'Electricity Charges 01.07.2008 to 01.07.2008'.
data: date_to_search(10) type c,
date type d.
write sy-datum to date_to_search using EDIT MASK 'LL__.__.____'.
if txt cs date_to_search.
write: 'Success'.
else.
write: 'Failure'.
endif.regards,
Marcin
Hi
I need to search for a date range in the format DD.MM.YYYY-DD.MM.YYYY in some text such as:
Electricity Charges on 12.11.2001 to 12.12.2001.
How would I extract that date range without using offsets as the date range could equally be like this:
12.11.2001 to 12.12.2001 Electricity Charges.
I am thinking of using regular expressions. Would this be the right way to go? I have never used them before are they simple to use?
Cheers
Ian
2008 Jul 01 3:21 PM
2008 Jul 01 3:25 PM
Hi,
Try to use this logic:
data: txt type string value 'Electricity Charges 01.07.2008 to 01.07.2008'.
data: date_to_search(10) type c,
date type d.
write sy-datum to date_to_search using EDIT MASK 'LL__.__.____'.
if txt cs date_to_search.
write: 'Success'.
else.
write: 'Failure'.
endif.regards,
Marcin
2008 Jul 01 4:03 PM
As it happens I've solved it myself but thank you for your help.-
FIND REGEX '(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d'
IN ls_open_items-sgtxt
MATCH OFFSET lv_offset.
Cheers
Ian
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |