Regular expressions
suggest changeIntroduction
Regular Expressions (sometimes called regexs or regexps) are a textual syntax which represents the patterns which can be matched in the strings operated upon.
Regular Expressions, introduced in c++11, may optionally support a return array of matched strings or another textual syntax defining how to replace matched patterns in strings operated upon.
Syntax
- regex_match // Returns whether the entire character sequence was matched by the regex, optionally capturing into a match object
- regex_search // Returns whether a portion of the character sequence was matched by the regex, optionally capturing into a match object
- regex_replace // Returns the input character sequence as modified by a regex via a replacement format string
- regex_token_iterator // Initialized with a character sequence defined by iterators, a list of capture indexes to iterate over, and a regex. Dereferencing returns the currently indexed match of the regex. Incrementing moves to the next capture index or if currently at the last index, resets the index and hinds the next occurrence of a regex match in the character sequence
- regex_iterator // Initialized with a character sequence defined by iterators and a regex. Dereferencing returns the portion of the character sequence the entire regex currently matches. Incrementing finds the next occurrence of a regex match in the character sequence
Parameters
|Signature|Description| |—|—| |bool regex_match(BidirectionalIterator first, BidirectionalIterator last, smatch& sm, const regex& re, regex_constraints::match_flag_type flags)
| BidirectionalIterator
is any character iterator that provides increment and decrement operators smatch
may be cmatch
or any other other variant of match_results
that accepts the type of BidirectionalIterator
the smatch
argument may be ommitted if the results of the regex are not needed Returns whether re
matches the entire character sequence defined by first
and last
| |bool regex_match(const string& str, smatch& sm, const regex re&, regex_constraints::match_flag_type flags)
| string
may be either a const char*
or an L-Value string
, the functions accepting an R-Value string
are explicitly deleted smatch
may be cmatch
or any other other variant of match_results
that accepts the type of str
the smatch
argument may be ommitted if the results of the regex are not needed Returns whether re
matches the entire character sequence defined by str
|