Search⌘ K
AI Features

Flags

Explore JavaScript regular expression flags to modify search patterns. Understand how flags affect global matching, case sensitivity, multiline searches, Unicode handling, and sticky mode, enhancing your text processing skills.

We'll cover the following...

Let’s quickly look at this topic before closing the chapter. Flags are the last bit of dynamic behavior we can add to our regular expressions. We mentioned them before, but we want to cover the full list of options here so you can have a full reference to check in the future.

Flags with descriptions and examples

As we mentioned, flags essentially allow you to change the way the RegExp parser understands your expressions. Here are their effects:

Flag Description Example
g Global match: This is the most common and the one we’ve been using
...