From 8ec33125731430870ed9735e3201560b2c6ecb37 Mon Sep 17 00:00:00 2001 From: danrega <16720986+danrega@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:51:36 +0100 Subject: [PATCH] Update content --- src/zcl_demo_abap_string_proc.clas.abap | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/zcl_demo_abap_string_proc.clas.abap b/src/zcl_demo_abap_string_proc.clas.abap index 648d7a6..6437a9a 100644 --- a/src/zcl_demo_abap_string_proc.clas.abap +++ b/src/zcl_demo_abap_string_proc.clas.abap @@ -1440,23 +1440,13 @@ CLASS zcl_demo_abap_string_proc IMPLEMENTATION. FIND ALL OCCURRENCES OF PCRE `(a.)|(b.)|(c.)` IN str_y18 - RESULTS DATA(res_y17) + RESULTS DATA(res_y19) IGNORING CASE. - LOOP AT res_y17 ASSIGNING FIELD-SYMBOL(). - LOOP AT -submatches ASSIGNING FIELD-SYMBOL(). - "Group 1 - IF sy-tabix = 1 AND -offset <> -1. - APPEND |Substring "{ substring( val = str_y18 off = -offset len = -length ) }" found, capturing group 1| TO tab_y17. - EXIT. - "Group 2 - ELSEIF sy-tabix = 2 AND -offset <> -1. - APPEND |Substring "{ substring( val = str_y18 off = -offset len = -length ) }" found, capturing group 2| TO tab_y17. - EXIT. - "Group 3 - ELSEIF sy-tabix = 3 AND -offset <> -1. - APPEND |Substring "{ substring( val = str_y18 off = -offset len = -length ) }" found, capturing group 3| TO tab_y17. - EXIT. + LOOP AT res_y19 ASSIGNING FIELD-SYMBOL(). + LOOP AT -submatches ASSIGNING FIELD-SYMBOL(). + IF -offset <> -1. + APPEND |Substring "{ substring( val = str_y18 off = -offset len = -length ) }" found, capturing group { sy-tabix }| TO tab_y17. ENDIF. ENDLOOP. ENDLOOP. @@ -1692,7 +1682,7 @@ CLASS zcl_demo_abap_string_proc IMPLEMENTATION. output->display( input = str_z23 name = `str_z23` ). output->display( input = str_z24 name = `str_z24` ). output->display( input = str_z25 name = `str_z25` ). - output->display( input = str_zb name = `str_zb` ). + output->display( input = str_zc name = `str_zc` ). output->display( input = itab_z name = `itab_z` ). output->display( input = |Number of replacements in itab (cnt_z26): { cnt_z26 }| ). @@ -1727,7 +1717,7 @@ CLASS zcl_demo_abap_string_proc IMPLEMENTATION. DATA str_tab_reg_find TYPE string_table. DATA(matcher_2) = cl_abap_regex=>create_pcre( pattern = 'A(.*?)B(.*?)C(.*?)' - ignore_case = abap_false )->create_matcher( text = 'AzyBxwvCuDtsErq' ). + ignore_case = abap_false )->create_matcher( text = 'A.12az.B.34by.C.56cx.D.78dw.E' ). IF matcher_2->match( ). DO.