Regular expressions

suggest change

Introduction

Regular expressions (sometimes called regexes or regexps) use textual patterns to describe strings to match.

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

Parameters

Signature Description
bool regex_match(BidirectionalIterator first, BidirectionalIterator last, smatch& sm, const regex& re, regex_constants::match_flag_type flags) BidirectionalIterator is any character iterator that provides increment and decrement operators. The match argument must be a match_results for that iterator type. smatch is correct only for std::string iterators, and cmatch is correct only for const char*. The match argument may be omitted 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_constants::match_flag_type flags) string may be either a const char* or an lvalue string. Overloads that take an rvalue string together with a match_results are deleted, because the match would refer to a temporary. smatch may be cmatch or any other variant of match_results that accepts the type of str. The smatch argument may be omitted if the results of the regex are not needed. Returns whether re matches the entire character sequence defined by str.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents