It appears that C++11 supports a whopping six different regular expression grammars:
- ECMA-262 (ECMAScript) regular expressions (slightly modified?)
- Basic POSIX regular expressions
- Extended POSIX regular expressions
- awk regular expressions
- grep regular expressions
- egrep regular expressions
Why was it decided to include so many options instead of settling on a single grammar? Why these particular 6?
The standardization process is all about pragmatism. There are benefits to including a RE grammar in the standard, as long as it’s correctly specified, but no benefit to dropping one.
Exclusion would make it easier for a library implementer to apply a “100% C++11 compliant” badge, but who really cares? Nobody should be making that claim anyway, and only ignorant PHBs would be looking for it. Libraries always have bugs which prevent reaching 100%, and a good library has an excess of features.
Note that all the included grammars are specified by already existing international standards. So little effort is needed on the part of the C++ committee. Just §28.13, which is a couple pages long.
If they leave out a standardized grammar, then different Standard Library implementers will add it under different names, resulting in incompatibility. This is unlikely to happen for a grammar which is merely defined by a popular library, where the library implementer will be responsible for the C++ interface, not Standard Library vendors.