In this section we will learn about the Regular Expression Modifiers in JavaScript.
Regular expression is nothing but the sequence of characters that forms a search pattern. Regular expression can be a single character, or a more complex pattern. Regular expression most oftenly used to perform all type of text search()
and text replace()
operations.
Search pattern is used for searching the data in a text and it describes what you are searching for.
Example:
var pattern = /Funda/g;
In the above code snippet /Funda/g is a regular expression, Funda is a pattern which is used in search, g is a modifier which is used to perform the global search across the string. If "g" is not specified at the last of the regular expression, JavaScript searches only for the first occurance of the matched pattern.
To learn regular expression in easy way, read this article.