I have this ABAP code to find text via a regular expression:
DATA: regex TYPE REF TO cl_abap_regex,
match TYPE REF TO cl_abap_matcher,
match_result_tab TYPE match_result_tab.
TRY.
CREATE OBJECT regex
EXPORTING
pattern = '01|012345'.
CATCH cx_sy_regex .
ENDTRY.
TRY.
CREATE OBJECT match
EXPORTING
regex = regex
text = '0123456'.
CATCH cx_sy_matcher.
ENDTRY.
CALL METHOD match->find_all
RECEIVING
matches = match_result_tab.
It finds '01' (but I expect '012345').
DATA: offset TYPE i, length TYPE i.
FIND REGEX '01|012345' IN '0123456'
MATCH OFFSET offset
MATCH LENGTH length.
It finds 012345
as I expect.
Can someone explain why the result is different.