Skip to content

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

Special Characters in Regular Expressions

The following tables summarize the special characters in regular expressions.

Other versions: 7.31 | 7.40 | 7.54

Escape Character

Special Character Meaning
\ Escape character for special characters


Note

The character string function escape can be used to prefix all special characters for regular expressions with their escape character.

Special Characters for Single Character Strings

Special Character Meaning
. Placeholder for any single character
\C Placeholder for any single character
\d Placeholder for any digit
\D Placeholder for any non-digit character
\l Placeholder for any lowercase letter
\L Placeholder for any non-lowercase letter
\s Placeholder for a blank character
\S Placeholder for a non-blank character
\u Placeholder for any uppercase letter
\U Placeholder for any non-uppercase letter
\w Placeholder for any alphanumeric character including _
\W Placeholder for any non-alphanumeric character except for _
[ ] Definition of a value set for single characters
[^ ] Negation of a value set for single characters
[ - ] Definition of a range in a value set for single characters
[[:alnum:]] Name for all alphanumeric characters in a value set
[[:alpha:]] Name for all letters in a value set
[[:blank:]] Name for blank characters and horizontal tabulators in a value set
[[:cntrl:]] Name for all control characters in a value set
[[:digit:]] Name for all digits in a value set
[[:graph:]] Name for all characters (apart from blank characters) that can be displayed and horizontal tabulators in a value set
[[:lower:]] Name for all lowercase letters in a value set
[[:print:]] Name for all characters in a value set that can be displayed
[[:punct:]] Name for all punctuation marks in a value set
[[:space:]] Name for all blank characters, tabulators, and carriage feeds in a value set
[[:unicode:]] Name for all Unicode characters in a value set with a code greater than 255
[[:upper:]] Name for all uppercase letters in a value set
[[:word:]] Name for all alphanumeric characters in a value set, and also _
[[:xdigit:]] Name for all hexadecimal digits in a value set
\a \f \n \r \t \v Various platform-specific control characters
[..] Reserved for future enhancements
[==] Reserved for future enhancements

More

Special Characters for Character String Patterns

Special Character Meaning
Chaining of n single characters
Chaining of at least n and a maximum of m single characters
Reserved for future enhancements
? One single character or no single characters
* Chaining of any number of single characters including 'no characters'
*? Reserved for future enhancements
+ Chaining of any number of single characters excluding 'no characters'
+? Reserved for future enhancements
( ) Definition of subgroups with registration
(?: ) Definition of subgroups without registration
\1, \2, \3 ... Placeholder for the registration of subgroups
\Q ... \E Definition of a string of literal characters
(? ... ) Reserved for future enhancements

More

Special Characters for Search Strings

Special Character Meaning
^ Anchor character for the start of a line
\A Anchor character for the start of a character string
$ Anchor character for the end of a line
\z Anchor character for the end of a character string
\Z The same as for \z. Line breaks at the end of the character string, however, are ignored
\< Start of a word
\> End of a word
\b Start or end of a word
\B Space between characters within a word
(?= ) Preview condition
(?! ) Negated preview condition
(?> ) Cut operator

More

Special Characters for Replacement Texts

Special Character Meaning
$0, $& Placeholder for the full occurrence
$1, $2, $3... Placeholder for the registration of subgroups
$` Placeholder for the text before the occurrence
$' Placeholder for the text after the occurrence

More