InterviewHubPRO
Section Overview
Q161

Question 161 of 521

Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

31%
JavaScript Internals (521 Qs)•Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

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,

javascript
  var text = "Learn JS one by one";
  var pattern = /one/g;
  var result = text.match(pattern); // one,one