In this blog , I am going to write about
JavaSript Regular Expressions, also commonly known as
REGEX. This is the first part of this series.
Let's get introduced with Regular Expressions 📖
REGEX is an object that describes a certain pattern of characters which is used to perform pattern-matching , find, search and replace functions on text or strings. It is also very important when we want to validate emails, usernames or passwords.
The basic syntax of a regex is :
A very simple example of searching a regex in a string is, you simply have to write your desired pattern inside the / /.
let testStr = "Search the word regex in this string";
let testRegEx = /regex/;
In this introduction part, I want to leave it just to the basic syntax. In the next part, we will learn how to search a regex within a string.