This is a FAQ in the sense of first asked questions. It’s not intended to be a long list of questions but only the first questions people are likely to ask. This page is intentionally very short. For more details, see Getting started with C++ TR1 regular expressions.
Q: Where can I get TR1?
A: Support for TR1 extensions in Visual Studio 2008 is added as a feature pack. Other implementations include the Boost and Dinkumware.
Q: What regular expression flavors are supported?
A: Depends on your implementation. Visual Studio 2008 supports these options:
Q: What header do I include?
Q: What namespace are things in?
Q: How do I do a match?
A: Construct a
regex object and pass it to
Q: How to I retrieve a match?
A: Use a form of
regex_search that takes a
match_result object as a parameter.
Q: How do a I a replace?
Q: How do I do a global replace?
A: The function
regex_replace does global replacements by default.
Q: How do I keep from doing a global replace?
A: Use the
format_first_only flag with
Q: How do I make a regular expression case-insensitive?
A: Use the
icase flag as a parameter to the