Ansicht
Dokumentation
ABENMATCH_FUNCTIONS - MATCH FUNCTIONS
ABAP Short Reference ROGBILLS - Synchronize billing plansThis documentation is copyright by SAP AG.
- match
The match function returns a substring of a character-like argument that matches a regular expression.
... match( val = text
pcre$|xpath = regex $[
case = case$] $[occ = occ$] ) ...
Effect
The built-in function match searches text for the match specified in occ with the regular expression specified in regex and returns the substring found. The search is case-sensitive by default, but this can be overridden using the parameter case.
- If the argument pcre is used, regex must contain a PCRE regular expression.
- If the argument xpath is used, regex must contain a XPath regular expression.
A regular expression in PCRE or XPath syntax is compiled in an extended mode: Most unescaped whitespace (blanks and line breaks) of the pattern are ignored outside character classes and comments can be placed behind #. In order to specify whitespace and # characters in a pattern, they must be escaped or the extended mode must be switched of with (?-x) in the regular expression.
The return value has the type string.
Note
Besides pcre and xpath, the obsolete argument regex can also be used. Then an obsolete POSIX regular expression must be passed.
Example
The following match function returns x2.
String Functions, count, find and match
Exceptions
Catchable Exceptions
- Cause: See Exceptions in Regular Expressions.
Runtime Error: REGEX_TOO_COMPLEX
- Cause: Regular expression in regex is empty or there are 0 occurrences in occ.
Runtime Error: STRG_ILLEGAL_PAR
CPI1466 during Backup PERFORM Short Reference
This documentation is copyright by SAP AG.
Length: 3885 Date: 20240329 Time: 121020 sap01-206 ( 53 ms )