Ansicht
Dokumentation
ABENREGEX_MTCH - REGEX MTCH
Fill RESBD Structure from EBP Component Structure CL_GUI_FRONTEND_SERVICES - Frontend ServicesThis documentation is copyright by SAP AG.
- 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.
Note
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 #. In ABAP statements and built-in functions, the extended mode is switched on by default. It can be switched of with the special character (?-x) in the regular expression. When using CL_ABAP_REGEX, it can be switched by the parameter EXTENDED of method CREATE_PCRE.
Searching
In order to search for substrings that match a pattern described by a regular expression you can use the following:
- Statement FIND with the addition PCRE$|REGEX.
- Built-in functions with the argument pcre$|xpath and with regex (obsolete):
- Methods of system class CL_ABAP_MATCHER.
Example
Demonstration of different possibilities for searching substrings that match a regular expression.
Replacing
In order to replace substrings that match a pattern described by a regular expression, the following can be used:
- Statement REPLACE with the addition PCRE$|REGEX.
- Methods of the system class CL_ABAP_MATCHER.
Example
Demonstration of different possibilities for replacing substrings that match a regular expression.
Matching
In order to check if a complete character string matches a regular expression, the following can be used:
- Built-in function matches with the argument pcre$|xpath or regex (obsolete).
- Methods of system class CL_ABAP_MATCHER.
Example
Demonstration of different possibilities for matching strings with a regular expression.
Vendor Master (General Section) ROGBILLS - Synchronize billing plans
This documentation is copyright by SAP AG.
Length: 5038 Date: 20240424 Time: 224513 sap01-206 ( 64 ms )