SAP STRING FUNCTIONS REGEX



Get Example source ABAP code based on a different SAP table
  


• pcre ABAP_FUNCTION_PARA
• xpath ABAP_FUNCTION_PARA

ABAP_STRINGFUNC - pcre, xpath

ABAP_SYNTAX
... ( ... pcre$| xpath = regex ... ) ...

What does it do?
pcre$|xpath$ is used to pass a regular expression to be searched for or compared to. regex is a character-like expression position that must contain a correct regular expression. Only arguments with elementary data types can be specified.
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.
If a character-like data object with a fixed length is specified, any trailing blanks are ignored. If regex is empty, an exception from the class CX_SY_STRG_PAR_VAL is raised.
The regular expression is compiled 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 include whitespace and # into a pattern, they must be escaped or the extended mode must be switched of with (?-x) in the regular expression.



Latest notes:

The regular expression in regex may have correct syntax but be too complex for the execution of the function, which can raise a catchable exception of the class CX_SY_REGEX_TOO_COMPLEX. See Exceptions in Regular Expressions.
Besides pcre and xpath, also the obsolete argument regex can be used. Then an obsolete POSIX regular expression must be passed.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The result of the following function call is < tag>def<(><<)>/tag> . By placing a question mark (?) behind the + quantifier, the greedy behavior of the PCRE regular expression is switched off for that wildcard character.
ABEXA 01300
ABAP_EXAMPLE_END