1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
Different from tt(regex_match) the regular expression matching function
tt(std::regex_search)hi(regex_search) returns tt(true) if the regular
expression defined in its tt(regex) argument partially matches the target
text.
The following overloaded variants of this function are available:
itemization(
ittq(bool regex_search(BidirConstIter first, BidirConstIter last,
std::match_results &results,
std::regex const &re))
(tt(BidirConstIter) is a bidirectional const iterator. The range
rangett(first, last) defines the target text. The match results are
returned in tt(results). The types of the iterators must match the
type of the tt(match_results) that's used. E.g., a tt(cmatch) should
be used if the iterators are of tt(char const *) types, and a
tt(smatch) should be used if the iterators are of
tt(string::const_iterator) types. Similar correspondence requirements
hold true for the other overloaded versions of this function;)
ittq(bool regex_search(BidirConstIter first, BidirConstIter last,
std::regex const &re))
(this function behaves like the previous function, but does not
return the results of the matching process in a tt(match_results)
object;)
ittq(bool regex_search(char const *target,
std::match_results &results, std::regex const &re))
(this function behaves like the first overloaded variant, using
the characters in tt(target) as its target text;)
ittq(bool regex_search(char const *str, std::regex const &re))
(this function behaves like the previous function but does not return
the match results;)
ittq(bool regex_search(std::string const &target,
std::match_results &results, std::regex const &re))
(this function behaves like the first overloaded variant, using
the characters in tt(target) as its target text;)
ittq(bool regex_search(std::string const &str, std::regex const &re))
(this function behaves like the previous function but does not return
the match results;)
ittq(bool regex_search(std::string const &&, std::match_results &,
std::regex &) = delete)
(the tt(regex_search) function does not accept temporary tt(string)
objects as target strings, as this would result in invalid string
iterators in the tt(match_result) argument.)
)
The following example illustrates how tt(regex_search) could be used:
verbinclude(-ans4 examples/regexsearch.cc)
|