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
With the escape
character string, all special characters for regular expressions can come before their escape characters.
Special Characters for Single Character Strings
Special character | Meaning |
---|---|
. | Placeholder for any single character |
\C | Placeholder for any single character |
\d | Placeholder for any single digit |
\D | Placeholder for any character other than a digit |
\l | Placeholder for any lowercase letter |
\L | Placeholder for any character other than a lowercase letter |
\s | Placeholder for a blank character |
\S | Placeholder for any character other than a blank character |
\u | Placeholder for any uppercase letter |
\U | Placeholder for any character other than an 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:]] | Description of all alphanumeric characters in a value set |
[[:alpha:]] | Description of all letters in a value set |
[[:blank:]] | Description for blank characters and horizontal tabulators in a value set |
[[:cntrl:]] | Description of all control characters in a value set |
[[:digit:]] | Description of all digits in a value set |
[[:graph:]] | Description of all characters in a value set that can be displayed apart from blank characters and horizontal tabulators |
[[:lower:]] | Description of all lowercase letters in a value set |
[[:print:]] | Description of all characters in a value set that can be displayed |
[[:punct:]] | Description of all punctuation characters in a value set |
[[:space:]] | Description of all blank characters, tabulators, and carriage feeds in a value set |
[[:unicode:]] | Description of all Unicode characters in a value set with a code larger than 255 |
[[:upper:]] | Description of all uppercase letters in a value set |
[[:word:]] | Description of all alphanumeric characters in a value set, including _ |
[[:xdigit:]] | Description of all hexadecimal digits in a value set |
\a \f \n \r \t \v | Various platform-specific control characters |
[..] | Reserved for later enhancements |
[==] | Reserved for later enhancements |
Special Characters for Character String Patterns
Special character | Meaning |
---|---|
Concatenation of n single characters | |
Concatenation of at least n and a maximum of m single characters | |
Reserved for later enhancements | |
? | One or no single characters |
* | Concatenation of any number of single characters including 'no characters' |
*? | Reserved for later enhancements |
+ | Concatenation of any number of single characters excluding 'no characters' |
+? | Reserved for later enhancements |
( ) | Definition of subgroups with registration |
(?: ) | Definition of subgroups without registration |
\1, \2, \3 ... | Placeholder for the register of subgroups |
\Q ... \E | Definition of a string of literal characters |
(? ... ) | Reserved for later enhancements |
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 | Like \z, whereby line breaks at the end of the character string 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 |
Special Characters for Replacement Texts
Special character | Meaning |
---|---|
$0, $& | Placeholder for the whole found location |
$1, $2, $3... | Placeholder for the register of subgroups |
$` | Placeholder for the text before the found location |
$' | Placeholder for the text after the found location |