49 lines
11 KiB
Markdown
49 lines
11 KiB
Markdown
[re.syn]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.6 Regular expressions library [[re]](re#syn)
|
||
|
||
### 28.6.3 Header <regex> synopsis [re.syn]
|
||
|
||
[ð](#header:%3cregex%3e)
|
||
|
||
#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")#include <initializer_list> // see [[initializer.list.syn]](initializer.list.syn "17.11.2 Header <initializer_list> synopsis")namespace std {// [[re.const]](re.const "28.6.4 Namespace std::regex_constants"), regex constantsnamespace regex_constants {using syntax_option_type = *T1*; using match_flag_type = *T2*; using error_type = *T3*; }// [[re.badexp]](re.badexp "28.6.5 Class regex_error"), class regex_errorclass regex_error; // [[re.traits]](re.traits "28.6.6 Class template regex_traits"), class template regex_traitstemplate<class charT> struct regex_traits; // [[re.regex]](re.regex "28.6.7 Class template basic_regex"), class template basic_regextemplate<class charT, class traits = regex_traits<charT>> class basic_regex; using regex = basic_regex<char>; using wregex = basic_regex<wchar_t>; // [[re.regex.swap]](re.regex.swap "28.6.7.6 Swap"), basic_regex swaptemplate<class charT, class traits>void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2); // [[re.submatch]](re.submatch "28.6.8 Class template sub_match"), class template sub_matchtemplate<class BidirectionalIterator>class sub_match; using csub_match = sub_match<const char*>; using wcsub_match = sub_match<const wchar_t*>; using ssub_match = sub_match<string::const_iterator>; using wssub_match = sub_match<wstring::const_iterator>; // [[re.submatch.op]](re.submatch.op "28.6.8.3 Non-member operators"), sub_match non-member operatorstemplate<class BiIter>bool operator==(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs); template<class BiIter>auto operator<=>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs); template<class BiIter, class ST, class SA>bool operator==(const sub_match<BiIter>& lhs, const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs); template<class BiIter, class ST, class SA>auto operator<=>(const sub_match<BiIter>& lhs, const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs); template<class BiIter>bool operator==(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type* rhs); template<class BiIter>auto operator<=>(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type* rhs); template<class BiIter>bool operator==(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type& rhs); template<class BiIter>auto operator<=>(const sub_match<BiIter>& lhs, const typename iterator_traits<BiIter>::value_type& rhs); template<class charT, class ST, class BiIter> basic_ostream<charT, ST>&operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m); // [[re.results]](re.results "28.6.9 Class template match_results"), class template match_resultstemplate<class BidirectionalIterator, class Allocator = allocator<sub_match<BidirectionalIterator>>>class match_results; using cmatch = match_results<const char*>; using wcmatch = match_results<const wchar_t*>; using smatch = match_results<string::const_iterator>; using wsmatch = match_results<wstring::const_iterator>; // match_results comparisonstemplate<class BidirectionalIterator, class Allocator>bool operator==(const match_results<BidirectionalIterator, Allocator>& m1, const match_results<BidirectionalIterator, Allocator>& m2); // [[re.results.swap]](re.results.swap "28.6.9.8 Swap"), match_results swaptemplate<class BidirectionalIterator, class Allocator>void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||
match_results<BidirectionalIterator, Allocator>& m2); // [[re.alg.match]](re.alg.match "28.6.10.2 regex_match"), function template regex_matchtemplate<class BidirectionalIterator, class Allocator, class charT, class traits>bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||
match_results<BidirectionalIterator, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class BidirectionalIterator, class charT, class traits>bool regex_match(BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class charT, class Allocator, class traits>bool regex_match(const charT* str, match_results<const charT*, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_match(const basic_string<charT, ST, SA>& s,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_match(const basic_string<charT, ST, SA>&&,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>&, const basic_regex<charT, traits>&,
|
||
regex_constants::match_flag_type = regex_constants::match_default) = delete; template<class charT, class traits>bool regex_match(const charT* str, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class charT, class traits>bool regex_match(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); // [[re.alg.search]](re.alg.search "28.6.10.3 regex_search"), function template regex_searchtemplate<class BidirectionalIterator, class Allocator, class charT, class traits>bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||
match_results<BidirectionalIterator, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class BidirectionalIterator, class charT, class traits>bool regex_search(BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class charT, class Allocator, class traits>bool regex_search(const charT* str,
|
||
match_results<const charT*, Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class charT, class traits>bool regex_search(const charT* str, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class charT, class traits>bool regex_search(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_search(const basic_string<charT, ST, SA>& s,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>& m, const basic_regex<charT, traits>& e,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class ST, class SA, class Allocator, class charT, class traits>bool regex_search(const basic_string<charT, ST, SA>&&,
|
||
match_results<typename basic_string<charT, ST, SA>::const_iterator,
|
||
Allocator>&, const basic_regex<charT, traits>&,
|
||
regex_constants::match_flag_type = regex_constants::match_default) = delete; // [[re.alg.replace]](re.alg.replace "28.6.10.4 regex_replace"), function template regex_replacetemplate<class OutputIterator, class BidirectionalIterator, class traits, class charT, class ST, class SA> OutputIterator
|
||
regex_replace(OutputIterator out,
|
||
BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e, const basic_string<charT, ST, SA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class OutputIterator, class BidirectionalIterator, class traits, class charT> OutputIterator
|
||
regex_replace(OutputIterator out,
|
||
BidirectionalIterator first, BidirectionalIterator last, const basic_regex<charT, traits>& e, const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT, class ST, class SA, class FST, class FSA> basic_string<charT, ST, SA> regex_replace(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e, const basic_string<charT, FST, FSA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT, class ST, class SA> basic_string<charT, ST, SA> regex_replace(const basic_string<charT, ST, SA>& s, const basic_regex<charT, traits>& e, const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT, class ST, class SA> basic_string<charT> regex_replace(const charT* s, const basic_regex<charT, traits>& e, const basic_string<charT, ST, SA>& fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); template<class traits, class charT> basic_string<charT> regex_replace(const charT* s, const basic_regex<charT, traits>& e, const charT* fmt,
|
||
regex_constants::match_flag_type flags = regex_constants::match_default); // [[re.regiter]](re.regiter "28.6.11.1 Class template regex_iterator"), class template regex_iteratortemplate<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_iterator; using cregex_iterator = regex_iterator<const char*>; using wcregex_iterator = regex_iterator<const wchar_t*>; using sregex_iterator = regex_iterator<string::const_iterator>; using wsregex_iterator = regex_iterator<wstring::const_iterator>; // [[re.tokiter]](re.tokiter "28.6.11.2 Class template regex_token_iterator"), class template regex_token_iteratortemplate<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_token_iterator; using cregex_token_iterator = regex_token_iterator<const char*>; using wcregex_token_iterator = regex_token_iterator<const wchar_t*>; using sregex_token_iterator = regex_token_iterator<string::const_iterator>; using wsregex_token_iterator = regex_token_iterator<wstring::const_iterator>; namespace pmr {template<class BidirectionalIterator>using match_results = std::match_results<BidirectionalIterator,
|
||
polymorphic_allocator<sub_match<BidirectionalIterator>>>; using cmatch = match_results<const char*>; using wcmatch = match_results<const wchar_t*>; using smatch = match_results<string::const_iterator>; using wsmatch = match_results<wstring::const_iterator>; }}
|