These flags may be specified in any combination. For example, to do a case-insensitive search for the first occurrence of the word “java” (or “Java”, “JAVA”, etc.), you can use the case-insensitive regular expression /\bjava\b/i. And to find all occurrences of the word in a string, you can add the g flag: /\bjava\b/gi.
Table 10-6 summarizes these regular-expression flags. Note that you’ll see more about the gflag later in this chapter, when the String and RegExp methods are used to actually perform matches.
Table 10-6. Regular-expression flags
|i||Perform case-insensitive matching.|
|g||Perform a global match—that is, find all matches rather than stopping after the first match.|
|m||Multiline mode. ^matches beginning of line or beginning of string, and $matches end of line or end of string.|