[re.submatch.members] # 28 Text processing library [[text]](./#text) ## 28.6 Regular expressions library [[re]](re#submatch.members) ### 28.6.8 Class template sub_match [[re.submatch]](re.submatch#members) #### 28.6.8.2 Members [re.submatch.members] [🔗](#lib:sub_match,constructor) `constexpr sub_match(); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10878) *Effects*: Value-initializes the pair base class subobject and the membermatched[.](#1.sentence-1) [🔗](#lib:sub_match,length) `difference_type length() const; ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10890) *Returns*: matched ? distance(first, second) : 0[.](#2.sentence-1) [🔗](#lib:operator_basic_string,sub_match) `operator string_type() const; ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10901) *Returns*: matched ? string_type(first, second) : string_type()[.](#3.sentence-1) [🔗](#lib:sub_match,str) `string_type str() const; ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10912) *Returns*: matched ? string_type(first, second) : string_type()[.](#4.sentence-1) [🔗](#lib:sub_match,compare) `int compare(const sub_match& s) const; ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10923) *Returns*: str().compare(s.str())[.](#5.sentence-1) [🔗](#lib:sub_match,compare_) `int compare(const string_type& s) const; ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10934) *Returns*: str().compare(s)[.](#6.sentence-1) [🔗](#lib:sub_match,compare__) `int compare(const value_type* s) const; ` [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10945) *Returns*: str().compare(s)[.](#7.sentence-1) [🔗](#lib:sub_match,swap) `void swap(sub_match& s) noexcept(see below); ` [8](#8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10956) *Preconditions*: BidirectionalIterator meets the *Cpp17Swappable* requirements ([[swappable.requirements]](swappable.requirements "16.4.4.3 Swappable requirements"))[.](#8.sentence-1) [9](#9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10961) *Effects*: Equivalent to:this->pair::swap(s); std::swap(matched, s.matched); [10](#10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L10969) *Remarks*: The exception specification is equivalent tois_nothrow_swappable_v[.](#10.sentence-1)