General Material Data   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

REPLACE, pattern

Short Reference

... ${$[SUBSTRING$] substring$}
  $| ${PCRE pcre$}$|${REGEX regex_ref$} ... .


Defines a search pattern for the statements REPLACE and REPLACE IN TABLE.

  • If substring is specified, the exact substring specified in substring is searched for. The optional addition SUBSTRING can be specified in front of substring for emphasis.
  • If PCRE or REGEX is specified, the substring that matches a regular expression specified in pcre or regex_ref is searched for.
  • PCRE denotes a PCRE regular expression in a character string pcre. The PCRE 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 include whitespace and # into a pattern, they must be escaped or the extended mode must be switched of with (?-x) in the regular expression.

  • REGEX denotes a any regular expression supported by ABAP represented by an instance of the system class CL_ABAP_REGEX referenced by a reference variable regex_ref.

substring and pcre are character-like expression positions. The syntax and semantics are the same as in the definition of a search pattern for the statement FIND. The statement REPLACE replaces the found substring in accordance with the specification after WITH.


  • Instances of CL_ABAP_REGEX for all kinds of regular expressions, PCRE, POSIX, XPath and XSD can be used with the addition REGEX. This circumvents the restriction that regular expressions of XPath and XSD syntax cannot be specified directly as character strings.
  • When using CL_ABAP_REGEX, the extended mode option can be switched by a parameter.


Replacement of the substring "all" with "er".


The following replacement with regular expression \D removes all non-digits from a string.

General Material Data   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 4450 Date: 20231005 Time: 050931     sap01-206 ( 70 ms )