Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for String Processing →  String Functions →  Common Parameters of Character String Functions 

regex - Regular Expression

Other versions: 7.31 | 7.40 | 7.54

Syntax


... ( ... regex = regex ...  ) ...

Effect

regex is used to pass a regular expression to be found or matched. regex is a character-like expression position that must contain a correct regular expression. Only arguments with elementary types can be specified.

If a character-like data object with a fixed length is specifed, any trailing blanks are ignored. If regex is empty, an exception from the class CX_SY_STRG_PAR_VAL is raised.


Note

The regular expression in regex may be have correct syntax but be too complex for the execution of the function, which can raise a handleable exception of the class CX_SY_REGEX_TOO_COMPLEX. See Exceptions in Regular Expressions.


Example

The result of the following function call is <tag>def</tag>.

DATA(result) = replace( val   = `<tag>abc</tag>` 
                       regex = `(<tag>)[^<]+(</tag>)` 
                        with  = `$1def$2` ).