This content originally appeared on DEV Community and was authored by Swarnali Roy
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/;
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.
This content originally appeared on DEV Community and was authored by Swarnali Roy
Swarnali Roy | Sciencx (2021-07-24T22:09:56+00:00) Regular Expression Part 1 : Introduction. Retrieved from https://www.scien.cx/2021/07/24/regular-expression-part-1-introduction/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.