In all `match_results` constructors, a copy of the Allocator argument is used
for any memory allocation performed by the constructor or member functions
during the lifetime of the object.
[#boost_regex.match_results.construct]
match_results(const Allocator& a = Allocator());
[*Effects]: Constructs an object of class `match_results`. The postconditions of
this function are indicated in the table:
[table
[[Element][Value]]
[[empty()][true]]
[[size()][0]]
[[str()][basic_string<charT>()]]
]
[#boost_regex.match_results.copy_construct]
match_results(const match_results& m);
[*Effects]: Constructs an object of class match_results, as a copy of m.
[#boost_regex.match_results.assign]
match_results& operator=(const match_results& m);
[*Effects]: Assigns m to *this. The postconditions of this function are
indicated in the table:
[table
[[Element][Value]]
[[empty()][m.empty().]]
[[size()][m.size().]]
[[str(n)][m.str(n) for all integers n < m.size().]]
[[prefix()][m.prefix().]]
[[suffix()][m.suffix().]]
[[(*this)\[n\]][m\[n\] for all integers n < m.size().]]
[[length(n)][m.length(n) for all integers n < m.size().]]
[[position(n)][m.position(n) for all integers n < m.size().]]
]
[#boost_regex.match_results.size]
size_type size()const;
[*Effects]: Returns the number of [sub_match] elements stored in *this; that is
the number of marked sub-expressions in the regular expression that was
matched plus one.
[#boost_regex.match_results.max_size]
size_type max_size()const;
[*Effects]: Returns the maximum number of [sub_match] elements that can be
stored in *this.
[#boost_regex.match_results.empty]
bool empty()const;
[*Effects]: Returns size() == 0.
[#boost_regex.match_results.length]
difference_type length(int sub = 0)const;
[*Effects]: Returns the length of sub-expression /sub/, that is to say:
`(*this)[sub].length()`.
[#boost_regex.match_results.position]
difference_type position(unsigned int sub = 0)const;
[*Effects]: Returns the starting location of sub-expression /sub/, or -1 if /sub/ was
not matched. Note that if this represents a partial match , then `position()`
will return the location of the partial match even though `(*this)[0].matched` is false.
[#boost_regex.match_results.str]
string_type str(int sub = 0)const;
[*Effects]: Returns sub-expression /sub/ as a string: `string_type((*this)[sub])`.
[#boost_regex.match_results.subscript]
const_reference operator[](int n) const;
[*Effects]: Returns a reference to the [sub_match] object representing the character
sequence that matched marked sub-expression /n/. If `n == 0` then returns a
reference to a [sub_match] object representing the character sequence that
matched the whole regular expression. If /n/ is out of range, or if /n/ is an
unmatched sub-expression, then returns a [sub_match] object whose matched
member is false.
[#boost_regex.match_results.prefix]
const_reference prefix()const;
[*Effects]: Returns a reference to the [sub_match] object representing the
character sequence from the start of the string being matched or searched, to the
start of the match found.
[#boost_regex.match_results.suffix]
const_reference suffix()const;
[*Effects]: Returns a reference to the [sub_match] object representing the
character sequence from the end of the match found to the end of the
string being matched or searched.
[#boost_regex.match_results.begin]
const_iterator begin()const;
[*Effects]: Returns a starting iterator that enumerates over all the marked
sub-expression matches stored in *this.
[#boost_regex.match_results.end]
const_iterator end()const;
[*Effects]: Returns a terminating iterator that enumerates over all the
marked sub-expression matches stored in *this.
[#boost_regex.match_results_format]
[#boost_regex.match_results.format]
template <class OutputIterator>
OutputIterator format(OutputIterator out,
const string_type& fmt,
match_flag_type flags = format_default);
[*Requires]: The type `OutputIterator` conforms to the Output Iterator requirements
(C++ std 24.1.2).
[*Effects]: Copies the character sequence `[fmt.begin(), fmt.end())` to
`OutputIterator` /out/. For each format specifier or escape sequence in
/fmt/, replace that sequence with either the character(s) it represents,
or the sequence of characters within `*this` to which it refers.
The bitmasks specified in flags determines what format specifiers or
escape sequences are recognized, by default this is the format used by
ECMA-262, ECMAScript Language Specification, Chapter 15 part
5.4.11 String.prototype.replace.
See the [link boost_regex.format format syntax guide for more information].
[*Returns]: out.
[#boost_regex.match_results.format2]
string_type format(const string_type& fmt,
match_flag_type flags = format_default);
[*Effects]: Returns a copy of the string /fmt/. For each format specifier or
escape sequence in /fmt/, replace that sequence with either the
character(s) it represents, or the sequence of characters within `*this` to
which it refers. The bitmasks specified in flags determines what format
specifiers or escape sequences are recognized, by default this is the format
used by ECMA-262, ECMAScript Language Specification, Chapter 15 part
5.4.11 String.prototype.replace.
See the [link boost_regex.format format syntax guide for more information].
[#boost_regex.match_results.get_allocator]
allocator_type get_allocator()const;
[*Effects]: Returns a copy of the Allocator that was passed to the object's constructor.
[#boost_regex.match_results.swap]
void swap(match_results& that);
[*Effects]: Swaps the contents of the two sequences.
[*Postcondition]: *this contains the sequence of matched sub-expressions that were in that, that contains the sequence of matched sub-expressions that were in *this.
[*Effects]: returns a sequence containing all the captures obtained for sub-expression i.
[*Returns]: `(*this)[i].captures();`
[*Preconditions]: the library must be built and used with BOOST_REGEX_MATCH_EXTRA defined,
and you must pass the flag match_extra to the regex matching functions
([regex_match], [regex_search], [regex_iterator] or [regex_token_iterator]) in
order for this member function to be defined and return useful information.
[*Rationale]: Enabling this feature has several consequences:
* sub_match occupies more memory resulting in complex expressions running out of memory or stack space more quickly during matching.
* The matching algorithms are less efficient at handling some features (independent sub-expressions for example), even when match_extra is not used.
* The matching algorithms are much less efficient (i.e. slower), when match_extra is used. Mostly this is down to the extra memory allocations that have to take place.
[#boost_regex.match_results.op_eq]
template <class BidirectionalIterator, class Allocator>