Regular Expression Modifiers
The modifiers are optional modifiers that affect the way the pattern is matched.
- g: The g modifier matches the pattern globally, which means that it matches the pattern in the entire string.
- i: The i modifier makes the pattern case-insensitive.
- m: The m modifier matches the pattern across multiple lines.
You can add modifiers by appending them to the regular expression.
let regex = /pattern/gi;
This regex will perform a global, case-insensitive search for “pattern.”