FrontendDeveloper.in

JavaScript question detail

What are modifiers in regular expression

Modifiers can be used to perform case-insensitive and global searches. Let's list some of the modifiers,

ModifierDescription
iPerform case-insensitive matching
gPerform a global match rather than stops at first match
mPerform multiline matching

Let's take an example of global modifier,

var text = "Learn JS one by one";
var pattern = /one/g;
var result = text.match(pattern); // one,one
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399