aracters.

[ regex_match  ](/w/cpp/regex/regex_match "cpp/regex/regex match") (C++11)  |  attempts to match a regular expression to an entire character sequence   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_regex_match&action=edit)  
---|---  
[ regex_search  ](/w/cpp/regex/regex_search "cpp/regex/regex search") (C++11)  |  attempts to match a regular expression to any part of a character sequence   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_regex_search&action=edit)  
[ regex_replace  ](/w/cpp/regex/regex_replace "cpp/regex/regex replace") (C++11)  |  replaces occurrences of a regular expression with formatted replacement text   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_regex_replace&action=edit)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/regex&action=edit&section=4 "Edit
section: Iterators") ]  Iterators

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

[ regex_iterator  ](/w/cpp/regex/regex_iterator "cpp/regex/regex iterator") (C++11)  |  iterates through all regex matches within a character sequence   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_regex_iterator&action=edit)  
---|---  
[ regex_token_iterator  ](/w/cpp/regex/regex_token_iterator "cpp/regex/regex token iterator") (C++11)  |  iterates through the specified sub-expressions within all regex matches in a given string or through unmatched substrings   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_regex_token_iterator&action=edit)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/regex&action=edit&section=5 "Edit
section: Exceptions") ]  Exceptions

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

[ regex_error  ](/w/cpp/regex/regex_error "cpp/regex/regex error") (C++11)  |  reports errors generated by the regular expressions library   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_regex_error&action=edit)  
---|---  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/regex&action=edit&section=6 "Edit
section: Traits") ]  Traits

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

[ regex_traits  ](/w/cpp/regex/regex_traits "cpp/regex/regex traits") (C++11)  |  provides metainformation about a character type, required by the regex library   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_regex_traits&action=edit)  
---|---  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/regex&action=edit&section=7 "Edit
section: Constants") ]  Constants

Defined in namespace ` std::regex_constants `  
---  
[ syntax_option_type  ](/w/cpp/regex/syntax_option_type "cpp/regex/syntax option type") (C++11)  |  general options controlling regex behavior   
(typedef)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_syntax_option_type&action=edit)  
[ match_flag_type  ](/w/cpp/regex/match_flag_type "cpp/regex/match flag type") (C++11)  |  options specific to matching   
(typedef)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_match_flag_type&action=edit)  
[ error_type  ](/w/cpp/regex/error_type "cpp/regex/error type") (C++11)  |  describes different types of matching errors   
(typedef)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/regex/dsc_error_type&action=edit)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/regex&action=edit&section=8 "Edit
section: Example") ]  Example

Run this code

    
    
    #include <iostream>
    #include <iterator>
    #include <regex>
    #include <string>
     
    int main()
    {
        [std::str