Regular expressions have special characters with lots of meaning and expressions. We express what we want to do with these and reach the desired result. Let’s first look at what these characters are, and then try how they are used with examples.

Special characters used in regular expressions:

Character Explanation
d Refers to any number
. Refers to any character except carriage return
w Refers to any letter, number, or underscore
s Refers to any invisible character and void. (Such as space, tab, carriage return)
^ Refers to beginning
$ Refers to end
* Your character written before yourself; Refers to zero or more repetitions
+ Your character written before yourself; Refers to one or more repetitions
? Your character written before yourself; expresses its acceptance whether it is possible or not
{123} Your character written before yourself; It refers to repetition of the number written in parentheses.
{1, 2} Your character written before yourself; refers to repetition between two numbers written in parentheses.
( … ) It is used to group expressions written in parentheses.
( … \| … ) Written in parentheses “|” stands for or stands for the right dash, it refers to the match of any of the expressions written inside and separated by a right hyphen
[ … ] Refers to one of the characters written in square brackets.
Escape character. When we want to write the characters we wrote above normally, we put the escape sign in front of them. For example to express the point.
D Refers to any non-digit character
S Refers to invisible and non-whitespace character
W Refers to the character that is not a letter, digit, or underscore
b Expresses the beginning or end of the word
[^ … ] Refers to characters other than those typed instead of ellipses
[a-z] Refers to one of the letters from A to Z.