15Flags i m s g
Flags change how the whole pattern behaves: case, lines, dot and global search.
Flags (also called modifiers) are switches for the whole pattern. In JavaScript they follow the closing slash: /hello/gi. In the tester, click the flags button next to the pattern.
g | global – find all matches, not just the first |
i | insensitive – ignore upper/lower case |
m | multi line – ^ and $ match at every line |
s | single line – . also matches line breaks |
u | unicode – full Unicode, \p{…} properties |
In these exercises, type the flags in the small box next to the pattern.
Exercises
Lesson complete – well done!