SAP REGEX MTCH
Get Example source ABAP code based on a different SAP table
VERSION 5 IN
ABAP_REGEX - Searching, Replacing, Matching
Regular expressions can be used to find and replace substrings of character strings or to check if a complete character string matches its pattern. If a regular expression is applied to a character string as a search pattern, a search for matches of the regular expression with substrings of the character string is intended. In this case, special characters in the regular expression do not match characters, but match positions, thus affecting the type and number of occurrences. If a regular expression is applied to a character string as a match pattern, it is checked whether the character string matches a pattern.
ITOC
Latest notes:
A regular expression in PCRE or XPath syntax can be compiled in a normal or extended mode. In the extended mode, most unescaped whitespace (blanks and line breaks) of the pattern are ignored outside character classes and comments can be placed behind
NON_V5_HINTS
ABAP_HINT_END
Searching
In order to search for substrings that match a pattern described by a regular expression you can use the following:
ABAP_EXAMPLE_VX5
Demonstration of different possibilities for searching substrings that match a regular expression.
ABEXA 01451
ABAP_EXAMPLE_END
Replacing
In order to replace substrings that match a pattern described by a regular expression, the following can be used:
ABAP_EXAMPLE_VX5
Demonstration of different possibilities for replacing substrings that match a regular expression.
ABEXA 01452
ABAP_EXAMPLE_END
Matching
In order to check if a complete character string matches a regular expression, the following can be used:
ABAP_EXAMPLE_VX5
Demonstration of different possibilities for matching strings with a regular expression.
ABEXA 01453
ABAP_EXAMPLE_END