. Match any character Classes x ^ Match beginning of input $ Match end of input C++11 ECMAScript regex alpha Lowercase and uppercase letters a \b Match word boundary digit or d Digits; shorthand: \d t \B Match anything other Repetition Sets alnum or w Characters from either alpha or digit classes than a word boundary shorthand for [_[:alnum:]]: \w n | Or operator space or s Whitespace characters; shorthand: \s Symbol Repeats matched Symbol Matches y blank Space or tab cpprocks.com ? <= 1 [abc] Any of the characters included Capture groups cntrl File format escape characters (\n, \r etc.) S * >= 0 [^abc] Any of the characters NOT included punct Punctuation characters + >= 1 [a-z] Any characters in the range Denoted with parentheses lower Lowercase letters {n} n [a-zA-Z] Any characters in the ranges Referred to as \1, \2 etc. upper Uppercase letters {n,} >= n [=c=] Equivalence class for the character Counted in order of left parentheses: graph Characters from lower, upper, digit or punct {n, m} >= n && <= m [.ae.] Specified collating element print Characters from either graph or space ((\d+)-\2):\1 xdigit Hexadecimal digits (including both lowercase and uppercase a-f)
bool regex_match (first_iter, last_iter, match_res&, const& regex, [flags]) basic_regex
(first_iter, last_iter, const& regex, [flags]) s (first_iter, last_iter, [flags]) Holds the results of a regex match
(str, match_res&, const& regex, [flags]) e (const* regex_str, [flags])
(str, const& regex, [flags]) e Stores a regular expression m Methods Returns true if the whole input string matches the regex; s
s operator= Assign another match results object
details of the matches in match_res s
h Constructor flags get_allocator Return the allocator s t icase Perform case-insensitive matching ready Return true if result state is fully established a i bool nosubs Don't store sub-matches in the match_results object empty Return true if size() == 0 regex_search a l optimize Pay more attention to matching speed instead of the size Return 1 + the number of marked sub-expressions r Returns true if a substring of the input string matches the regex; l speed of constructing a regex object. Constructing Same parameters as regex_match max_size The max possible number of sub_match elements C o a regex object with this flag can be much slower. Use format Produce an output sequence using a format string C only when you really need to speed up the matching Regex constructor flags affecting regex_match & regex_search swap Swap with another match_results object g collate Make character ranges locale sensitive match_not_bol Don't treat the first position in the input as the beginning of line length The length of a given submatch l match_not_eol Don't treat the past-the-end position in the input as the end of a line position Distance from start of input to given submatch Methods match_not_bow Don't treat the first position in the input as the beginning of a word str Convert specified submatch to string type A operator=/assign Assign a different regular expression match_not_eow Don't treat the past-the-end position in the input as the end of a word operator[] Return a reference to the given sub_match object flags Return a copy of flags passed to the ctor match_any Any match is acceptable when more than one match is possible prefix A reference to the sub_match object representing getloc Get the locale match_not_null Don't match an empty input the substrsing of the input before the match imbue Set the locale match_continuous Don't search for matches other than at the beginning of the input suffix A reference to the sub_match object for mark_count Return the number of marked sub-expressions match_prev_avail --first is a valid iterator; if set, ignore match_not_bol and the rest of the input after the match swap Swap with another regex object match_not_bow begin/cbegin Start iterator that enumerates submatches end/cend End iterator that enumerates submatches out_iter regex_replace(out_iter, first_iter, last_iter, const& regex, Typedefs const& format_str, [flags]) regex basic_regex
Data members regex_iterator
Regex flags affecting regex_replace s Uses regex_search to iterate over regex matches in the input string format_no_copy Don't output the parts of the input string before and after the match first Iterator pointing to the start of the submatch r format_first_only Only replace the first occurrence of the found pattern second Iterator pointing to the end of the submatch matched True if the object describes a submatch Typedefs o sregex_iterator regex_iterator
$` The part of the source string that comes before the substring in $0 str/ Convert to string type r $' The part of the source string that comes after the substring in $0 operator str_type compare Compare matched subsequence e regex_token_iterator Given the regex (c+)(d+)ef and the input abccddefgg, the format specifiers t Iterates over matches or submatches in the input string
will denote the following: Typedefs I $` $0 $' csub_match sub_match