DEV Community 👩‍💻👨‍💻

Cover image for Regular Expression Part 1 : Introduction
Swarnali Roy
Swarnali Roy

Posted on • Updated on

Regular Expression Part 1 : Introduction

Hello readers!
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.

Basic Syntax

The basic syntax of a regex is : /pattern/

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/;
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (1)

Collapse
 
yoshida profile image
Masao Yoshida • Edited on

I hope for your next blog.

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.