Special Characters for Regular Expressions
Telegram link News Phone +7 495 25 506 20

Special Characters for Regular Expressions


In the table below, you can find most frequently used special characters. You can find the full list of character in topic “Regular Expression Operations”.

Special CharacterDescriptionRegular Expression ExampleExamples of Words That Can Be Found Using Regular Expression
.Any single character, except for a new line \np.pp.r.pepper, p0pp0r
\dAny digitBoeing\d\dBoeing2707, Boeing787
\DAny character, except for a digit926\D123926)123, 1926-123
\sSpace, line break, end of line, etc.sushi\spizzasushi pizza
\SAny character, except for a space, tab, end of line, etc.\S123X123, i123, !123
\wAny letter (anything that can be a part of a word), as well as digits and low line (_)\w\w\wYear, f_3, qwe
\WAny character, except for a letter, digit, or low line (_)com\Wcom!, com?
[..]Single character that belongs to the range of digits or letters[0-9][A-F]1B, 4F, 0D
[^..]Any character, except for those listed within the brackets<[^>]><1>

In the table below, you can find the list of special characters that allow you to set the number of repetitions (quantifiers).

Special CharacterDescriptionRegular Expression ExampleExamples of Words That Can Be Found Using Regular Expression
{n}n repetitions exactly

\d{4}

Regular expression searches for any four digits that follow each other

1234, 8790, 7564
{m,n}From m to n repetitions inlcuded

\d{2,4}

Regular expression searches for any two, three, or four digits that follow each other

12, 123, 1234, 54, 765, 9999
{m,}No less than m repetitions

\d{3,}

Regular expression searches for at least any three digits that follow each other

123, 4567, 0987654
{,n}No more than n repetitions

\d{,2}

Regular expression searches for no more than any two digits that follow each other

0, 3, 44, 56
*Zero or more repetitions. You can replace it by {0,}

Boing\d*

Regular expression searches for phrases that start with word Boeing followed by no digits or several digits

Boeing, Boeing1, Boeing2345
+One repetition or more. You can replace it by {1,}

a)+

Regular expression searches for phrases that have at least one bracket ) after letter a

a), a)), a)))
 

By default, quantifiers are “greedy”, i.e. they capture as much characters as possible. Add a question mark (?) after a quantifier to make it “lazy”.

Help from integrators