代码:
DATA: lv_string TYPE string VALUE 'abc123def456'.
DATA: lv_result TYPE string.
REPLACE ALL OCCURRENCES OF REGEX '[^0-9]' IN lv_string WITH ''.
lv_result = lv_string.
WRITE: / 'Result:', lv_result.
代码:
DATA:lv_str TYPE string,
lv_str1 TYPE string,
lv_len TYPE int4.
lv_str = 'IOUH1329IUSHIF92406I''SDK''L;F9.24'.
DO strlen( lv_str ) TIMES.
lv_len = sy-index - 1.
IF lv_str+lv_len(1) CA '1234567890'.
lv_str1 = lv_str1 && lv_str+lv_len(1).
ENDIF.
ENDDO.