Ansicht
Dokumentation

ABENREGEX_POSIX_SIMPLE - REGEX POSIX SIMPLE

ABENREGEX_POSIX_SIMPLE - REGEX POSIX SIMPLE

BAL Application Log Documentation   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

- Simplified Regular Expressions (obsolete)

CL_ABAP_REGEX also offers an alternative type of simplified regular expression with restricted functions. These simplified regular expressions (short: simplified expressions) do not support all POSIX operators and use partially different syntax. The semantics of regular expressions and simplified expressions are, however, the same.

Simplified Syntax

The following table provides an overview of the syntax differences between regular expressions and simplified regular expressions.

Regular Syntax Simplified Syntax
* *
+ Not supported
{ } \{ \}
( ) \( \)
[ ] [ ]
| Not supported
(?= ) (?! ) Not supported
(?: ) Not supported

This table shows that many special characters in the regular syntax have no effect in the simplified syntax. Parentheses and curly brackets must be prefixed with the character \ if they are to keep their function in the regular syntax.

Notes

  • Regular expressions with simplified syntax can only be used within the class CL_ABAP_REGEX. If the value 'X' is passed to the input parameter simple_regex, the regular expression is handled in accordance with the simplified syntax. By default, syntax in accordance with the extended POSIX standard is used. If the simplified syntax is to be used in the statements FIND or REPLACE, an object of the class CL_ABAP_REGEX must be passed.
  • The simplified syntax corresponds to the syntax of regular expressions in the command grep on Unix.

Example

This table shows the differences in parentheses between regular syntax and simplified syntax. The final two columns show examples that match the expressions in the first column, depending on the syntax used.

Pattern Regular Syntax Simplified Syntax
(.) a (a)
\(.\) (a) a

The first search uses regular syntax and finds the first three letters "aaa". The second search has simplified syntax, where "+" does not have any meaning as a special character and finds the substring "a+" from offset 2.






PERFORM Short Reference   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 3841 Date: 20240424 Time: 013015     sap01-206 ( 54 ms )