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
565

I have the following RegEx. I need to split ip numbers alone from the string


data: v_str     type string ,
      t_result  type match_result_tab ,
      wa_result like line of t_result,
      lt_result type match_result_tab.
v_str = 'abc.com:122.11.31.12xyz.com:111.16.1.1sdn.com:123.122.0.4 '.
data matcher type ref to cl_abap_matcher.
matcher = cl_abap_matcher=>create(
  pattern = `d+.d+.d+.d+`
  ignore_case = 'X'
  text = v_str ).
lt_result = matcher->find_all( ).

Any Info?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
534

Your regex works in this case. The location of the matches is captured in the table, and you just need to loop through and print them:

loop at lt_result into wa_result.
  write:/ v_str+wa_result-offset(wa_result-length).
endloop.

I have the following RegEx. I need to split ip numbers alone from the string


data: v_str     type string ,
      t_result  type match_result_tab ,
      wa_result like line of t_result,
      lt_result type match_result_tab.
v_str = 'abc.com:122.11.31.12xyz.com:111.16.1.1sdn.com:123.122.0.4 '.
data matcher type ref to cl_abap_matcher.
matcher = cl_abap_matcher=>create(
  pattern = `d+.d+.d+.d+`
  ignore_case = 'X'
  text = v_str ).
lt_result = matcher->find_all( ).

Any Info?

2 REPLIES 2
Read only

Former Member
0 Likes
535

Your regex works in this case. The location of the matches is captured in the table, and you just need to loop through and print them:

loop at lt_result into wa_result.
  write:/ v_str+wa_result-offset(wa_result-length).
endloop.

Read only

former_member194669
Active Contributor
0 Likes
534

Thanks that worked.