Regular expressions library

< cpp
Regular expressions library
basic_regex (C++11)
sub_match (C++11)
match_results (C++11)
regex_match (C++11)
regex_search (C++11)
regex_replace (C++11)
regex_iterator (C++11)
regex_token_iterator (C++11)
regex_error (C++11)
regex_traits (C++11)
syntax_option_type (C++11)
match_flag_type (C++11)
error_type (C++11)

The regular expressions library provides a class that represents regular expressions, which are a kind of mini-language used to perform pattern matching within strings.

Also provided in the regular expressions library are utility classes that provide support for various algorithms, iterators, exceptions, and type traits.


[edit] Main classes

These classes encapsulate a regular expression and the results of matching a regular expression within a target sequence of characters.

regular expression object
(class template)
identifies the sequence of characters matched by a sub-expression
(class template)
identifies one regular expression match, including all sub-expression matches
(class template)

[edit] Algorithms

These functions are used to apply the regular expression encapsulated in a regex to a target sequence of characters..

attempts to match a regular expression to the entire character sequence
(function template)
attempts to match a regular expression to any part of the character sequence
(function template)
replaces occurrences of a regular expression with formatted replacement text
(function template)

[edit] Iterators

The regex iterators are used to traverse the entire set of regular expression matches found within a sequence.

iterates through all regex matches within a character sequence
(class template)
iterates through the specified sub-expressions within all regex matches in a given string or through unmatched substrings
(class template)

[edit] Exceptions

This class defines the type of objects thrown as exceptions to report errors from the regular expressions library.

reports errors generated by the regular expressions library

[edit] Traits

The regex traits class is used to encapsulate the localizable aspects of a regex.

provides metainformation about a character type, required by the regex library
(class template)

[edit] Constants

Defined in namespace std::regex_constants
general options controlling regex behavior
options specific to matching
describes different types of matching errors