Here, the optional second argument to the regex constructor regex_constants::grep specifies a grammar like the UNIX grep command, where, for example, you have to mask the grouping characters by additional backslashes (which have to be masked by backslashes in ordinary string literals). Section 14.9, page 739, discusses the differences of the various grammars supported.
All the previous examples used a separate object to specify the regular expression. This is not necessary; however, note that just passing a string or string literal as a regular expression is not enough. Although an implicit type conversion is declared, the resulting statement won’t compile, because it is ambiguous. For example: