SAP REGEX XSD - Syntax



Get Example source ABAP code based on a different SAP table
  


VERSION 5 IN

ABAP_REGEX - XSD Syntax
Objects for XSD regular expressions can be created with the factory method CREATE_XSD of the system class CL_ABAP_REGEX to be used in statements FIND and REPLACE or with the system class CL_ABAP_MATCHER.
Currently, there is no detailed description of the XSD syntax for regular expressions in the ABAP keyword documentation.
For a short syntax overview, see Special Characters in XSD Regular Expressions
For the complete documentation, refer to Regular expressions in XSD 1.0 and 1.1.



Latest notes:

A regular expression with XSD syntax cannot be specified directly as a character string in the statements FIND and REPLACE, but you can use objects of CL_ABAP_REGEX that are created with method CREATE_XSD with the addition REGEX instead.
XSD Syntax is a subset of XPath syntax. There are mainly the following differences:
In a XSD regular expression, ^ and $ are not special characters for start and end of a line.
There is no XSD syntax for non-greedy behavior.
There is no XSD syntax for subgroups without registration
There is no XSD syntax for back references
NON_V5_HINTS
The test and demonstration program DEMO_REGEX allows XSD syntax to be tested by selecting XSD.
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The following example uses XSD syntax that is invalid for PCRE and does not find any matches for POSIX. It would work also for XPath. The regular expression contains special characters i and c that match any character that can be the first character of an XML name or any character that can occur after the first character of an XML name. The result of the replacement is <(>...<)>.
ABEXA 01476
ABAP_EXAMPLE_END