List of JavaScript regex modifiers

Last Updated On Thursday 20th Jan 2022

regex javascript

i modifier

g modifier

  • non-case sensitive matching. Upper and lower cases don’t matter.
  • global match. We attempt to find all matches instead of just returning the first match.
  • The internal state of the regular expression stores where is located the last match, and matching is resumed where it was left in the previous match.

m modifier

  • multiline match. It treats the ^ and $ characters to match the beginning and the end of each line of the tested string.
  • A newline character is determined by n or r.

u modifier

  • Unicode search. The regex pattern is treated as a Unicode sequence

y modifier

  • In Simple Sticky search
	> const str = 'Intresting Movie';

> /re/.test(str);
> /re/i.test(str);