Let’s now come to the example usage of the characters we listed in the table on this post. We will use the “d” and “+” characters to find only numbers in the content entered.

/d+/g

This example only matches the numbers 1234, 321 789. With the setting “g”, we expressed the comprehensive search, not just once.

At the beginning of the “+” character, which denotes one or more repetitions, we wrote “d”, which denotes any number. For a more useful example, let’s catch the expression written in date format in the content entered.

/(d{2}.d{2}.d{4})/g

Do not scare yourself and be confused, you can summarize what happened when you extract it by examining the relevant places. d{2} the number 2, after. We expressed the point . with the escape character, and the number 4 in the last part. So it will match content like 19.03.2021.