Files
2025-10-25 03:02:53 +03:00

49 lines
11 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.1Header <compare> synopsis")#include <initializer_list> // see [[initializer.list.syn]](initializer.list.syn "17.11.2Header <initializer_­list> synopsis")namespace std {// [[re.const]](re.const "28.6.4Namespace 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.5Class regex_­error"), class regex_errorclass regex_error; // [[re.traits]](re.traits "28.6.6Class template regex_­traits"), class template regex_traitstemplate<class charT> struct regex_traits; // [[re.regex]](re.regex "28.6.7Class 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.6Swap"), 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.8Class 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.3Non-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.9Class 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.8Swap"), 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.2regex_­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.3regex_­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.4regex_­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.1Class 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.2Class 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>; }}