1. Introduction

Regular expressions are a topic that confuses and struggles a lot of developers due to its crypt syntax.

A regular expression is a string that contains a search pattern (ex. \[0–9]{2}\ this pattern accepts a 2 digit number), and we use it to find those patterns into texts.

2. How to Create a RegExp

In javascript we can create RegExp with 2 ways:

// a string with a format /<RegExp>/;

var twoDigitRegExp = /[0–9]{2}/; // Construct a new RegExp object

var twoDigitRegExp = new RegExp(‘[0–9]{2}’);

3. RegExp Building Blocks

Quantifiers