Regular expression is more complex, but you can use regular expression to kill many programmers, because others have written a lot of bad code, you can do it in one sentence.
^Enter the starting position of the string for the match.
[0-9] + matches multiple numbers, [0-9] matches a single number, + matches one or more.
ABC $matches the letter ABC and ends with ABC, and $is the end position of the matching input string.
The above regular expression translates as ^ starting to search for any number from 0 to 9 and ending with an ABC.
Test with ABAP language
DATA: matcher TYPE REF TO cl_abap_matcher, match TYPE match_result, itab TYPE match_result_tab, line LIKE LINE OF itab. matcher = cl_abap_matcher=>create( pattern = '^[0-9]+abc$' text = '123abc' ). itab = matcher->find_all( ). LOOP AT itab INTO line. WRITE: / matcher->text,line-offset,line-length,matcher->text+line-offset(line-length). ENDLOOP.
Results of operation:
123abc 0 6 123abc