We already introduced some regex constants you can use to influence the behavior of the regex interfaces:
regex reg3(".*",regex_constants::grep); // use grep grammar
regex_replace (data, reg,
string(""), regex_constants::format_sed) // use sed replacement syntax
But there is more. Table 14.2 lists all regex constants provided by the regex library and where they can be used. In principle, they can always be passed as the optional last argument to the regex constructor or to the regex functions.
Here is a small program that demonstrates the usage of some flags: