<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="A compiled regular expression for searching Unicode haystacks."><title>Regex in regex::bytes - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../static.files/rustdoc-ac92e1bbe349e143.css"><metaname="rustdoc-vars"data-root-path="../../"data-static-root-path="../../static.files/"data-current-crate="regex"data-themes=""data-resource-suffix=""data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)"data-channel="1.76.0"data-search-js="search-2b6ce74ff89ae146.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../static.files/main-305769736d49e732.js"></script><noscript><linkrel="stylesheet"href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button></nav><navclass="sidebar"><divclass="sidebar-crate"><h2><ahref="../../regex/index.html">regex</a><spanclass="version">1.10.3</span></h2></div><h2class="location"><ahref="#">Regex</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block method"><li><ahref="#method.as_str">as_str</a></li><li><ahref="#method.capture_locations">capture_locations</a></li><li><ahref="#method.capture_names">capture_names</a></li><li><ahref="#method.captures">captures</a></li><li><ahref="#method.captures_at">captures_at</a></li><li><ahref="#method.captures_iter">captures_iter</a></li><li><ahref="#method.captures_len">captures_len</a></li><li><ahref="#method.captures_read">captures_read</a></li><li><ahref="#method.captures_read_at">captures_read_at</a></li><li><ahref="#method.find">find</a></li><li><ahref="#method.find_at">find_at</a></li><li><ahref="#method.find_iter">find_iter</a></li><li><ahref="#method.is_match">is_match</a></li><li><ahref="#method.is_match_at">is_match_at</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.replace">replace</a></li><li><ahref="#method.replace_all">replace_all</a></li><li><ahref="#method.replacen">replacen</a></li><li><ahref="#method.shortest_match">shortest_match</a></li><li><ahref="#method.shortest_match_at">shortest_match_at</a></li><li><ahref="#method.split">split</a></li><li><ahref="#method.splitn">splitn</a></li><li><ahref="#method.static_captures_len">static_captures_len</a></li></ul><h3><ahref="#trait-implementations">Trait Implementations</a></h3><ulclass="block trait-implementation"><li><ahref="#impl-Clone-for-Regex">Clone</a></li><li><ahref="#impl-Debug-for-Regex">Debug</a></li><li><ahref="#impl-Display-for-Regex">Display</a></li><li><ahref="#impl-FromSt
<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../../regex/all.html"title="show sidebar"></a></div><inputclass="search-input"name="search"aria-label="Run search in the documentation"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"tabindex="-1"><ahref="../../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Struct <ahref="../index.html">regex</a>::<wbr><ahref="index.html">bytes</a>::<wbr><aclass="struct"href="#">Regex</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../../src/regex/regex/bytes.rs.html#99-102">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><preclass="rust item-decl"><code>pub struct Regex { <spanclass="comment">/* private fields */</span> }</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>A compiled regular expression for searching Unicode haystacks.</p>
<p>A <code>Regex</code> can be used to search haystacks, split haystacks into substrings
or replace substrings in a haystack with a different substring. All
searching is done with an implicit <code>(?s:.)*?</code> at the beginning and end of
an pattern. To force an expression to match the whole string (or a prefix
or a suffix), you must use an anchor like <code>^</code> or <code>$</code> (or <code>\A</code> and <code>\z</code>).</p>
<p>Like the <code>Regex</code> type in the parent module, matches with this regex return
byte offsets into the haystack. <strong>Unlike</strong> the parent <code>Regex</code> type, these
byte offsets may not correspond to UTF-8 sequence boundaries since the
regexes in this module can match arbitrary bytes.</p>
<p>The only methods that allocate new byte strings are the string replacement
methods. All other methods (searching and splitting) return borrowed
<p>A common way to use regexes is with capture groups. That is, instead of
just looking for matches of an entire regex, parentheses are used to create
groups that represent part of the match.</p>
<p>For example, consider a haystack with multiple lines, and each line has
three whitespace delimited fields where the second field is expected to be
a number and the third field a boolean. To make this convenient, we use
the <ahref="struct.Captures.html#method.extract"title="method regex::bytes::Captures::extract"><code>Captures::extract</code></a> API to put the strings that match each group
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.new"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#178-180">source</a><h4class="code-header">pub fn <ahref="#method.new"class="fn">new</a>(re: &<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a>, <aclass="enum"href="../enum.Error.html"title="enum regex::Error">Error</a>></h4></section></summary><divclass="docblock"><p>Compiles a regular expression. Once compiled, it can be used repeatedly
to search, split or replace substrings in a haystack.</p>
<p>Note that regex compilation tends to be a somewhat expensive process,
and unlike higher level environments, compilation is not automatically
cached for you. One should endeavor to compile a regex once and then
reuse it. For example, it’s a bad idea to compile the same regex
repeatedly in a loop.</p>
<h5id="errors"><ahref="#errors">Errors</a></h5>
<p>If an invalid pattern is given, then an error is returned.
An error is also returned if the pattern is valid, but would
produce a regex that is bigger than the configured size limit via
<ahref="struct.RegexBuilder.html#method.size_limit"title="method regex::bytes::RegexBuilder::size_limit"><code>RegexBuilder::size_limit</code></a>. (A reasonable size limit is enabled by
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_match"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#202-204">source</a><h4class="code-header">pub fn <ahref="#method.is_match"class="fn">is_match</a>(&self, haystack: &[<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]) -><aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true if and only if there is a match for the regex anywhere
in the haystack given.</p>
<p>It is recommended to use this method if all you need to do is test
whether a match exists, since the underlying matching engine may be
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.find"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#230-232">source</a><h4class="code-header">pub fn <ahref="#method.find"class="fn">find</a><'h>(&self, haystack: &'h [<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Match.html"title="struct regex::bytes::Match">Match</a><'h>></h4></section></summary><divclass="docblock"><p>This routine searches for the first match of this regex in the
haystack given, and if found, returns a <ahref="struct.Match.html"title="struct regex::bytes::Match"><code>Match</code></a>. The <code>Match</code>
provides access to both the byte offsets of the match and the actual
substring that matched.</p>
<p>Note that this should only be used if you want to find the entire
match. If instead you just want to test the existence of a match,
it’s potentially faster to use <code>Regex::is_match(hay)</code> instead of
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.captures"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#353-355">source</a><h4class="code-header">pub fn <ahref="#method.captures"class="fn">captures</a><'h>(&self, haystack: &'h [<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Captures.html"title="struct regex::bytes::Captures">Captures</a><'h>></h4></section></summary><divclass="docblock"><p>This routine searches for the first match of this regex in the haystack
given, and if found, returns not only the overall match but also the
matches of each capture group in the regex. If no match is found, then
<code>None</code> is returned.</p>
<p>Capture group <code>0</code> always corresponds to an implicit unnamed group that
includes the entire match. If a match is found, this group is always
present. Subsequent groups may be named and are numbered, starting
at 1, by the order in which the opening parenthesis appears in the
pattern. For example, in the pattern <code>(?<a>.(?<b>.))(?<c>.)</code>, <code>a</code>,
<code>b</code> and <code>c</code> correspond to capture group indices <code>1</code>, <code>2</code> and <code>3</code>,
respectively.</p>
<p>You should only use <code>captures</code> if you need access to the capture group
matches. Otherwise, <ahref="struct.Regex.html#method.find"title="method regex::bytes::Regex::find"><code>Regex::find</code></a> is generally faster for discovering
) -><aclass="struct"href="struct.CaptureMatches.html"title="struct regex::bytes::CaptureMatches">CaptureMatches</a><'r, 'h><ahref="#"class="tooltip"data-notable-ty="CaptureMatches<'r, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator that yields successive non-overlapping matches in
the given haystack. The iterator yields values of type <ahref="struct.Captures.html"title="struct regex::bytes::Captures"><code>Captures</code></a>.</p>
<p>This is the same as <ahref="struct.Regex.html#method.find_iter"title="method regex::bytes::Regex::find_iter"><code>Regex::find_iter</code></a>, but instead of only providing
access to the overall match, each value yield includes access to the
matches of all capture groups in the regex. Reporting this extra match
data is potentially costly, so callers should only use <code>captures_iter</code>
over <code>find_iter</code> when they actually need access to the capture group
<spanclass="macro">assert_eq!</span>(<spanclass="kw-2">&</span>caps[<spanclass="string">"title"</span>], <spanclass="string">b"The Wizard of Oz"</span>);
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#562-564">source</a><h4class="code-header">pub fn <ahref="#method.split"class="fn">split</a><'r, 'h>(&'r self, haystack: &'h [<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]) -><aclass="struct"href="struct.Split.html"title="struct regex::bytes::Split">Split</a><'r, 'h><ahref="#"class="tooltip"data-notable-ty="Split<'r, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator of substrings of the haystack given, delimited by a
match of the regex. Namely, each element of the iterator corresponds to
a part of the haystack that <em>isn’t</em> matched by the regular expression.</p>
) -><aclass="struct"href="struct.SplitN.html"title="struct regex::bytes::SplitN">SplitN</a><'r, 'h><ahref="#"class="tooltip"data-notable-ty="SplitN<'r, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator of at most <code>limit</code> substrings of the haystack
given, delimited by a match of the regex. (A <code>limit</code> of <code>0</code> will return
no substrings.) Namely, each element of the iterator corresponds to a
part of the haystack that <em>isn’t</em> matched by the regular expression.
The remainder of the haystack that is not split will be the last
) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/alloc/borrow/enum.Cow.html"title="enum alloc::borrow::Cow">Cow</a><'h, [<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]></h4></section></summary><divclass="docblock"><p>Replaces the leftmost-first match in the given haystack with the
replacement provided. The replacement can be a regular string (where
<code>$N</code> and <code>$name</code> are expanded to match capture groups) or a function
that takes a <ahref="struct.Captures.html"title="struct regex::bytes::Captures"><code>Captures</code></a> and returns the replaced string.</p>
<p>If no match is found, then the haystack is returned unchanged. In that
case, this implementation will likely return a <code>Cow::Borrowed</code> value
<p>But anything satisfying the <ahref="trait.Replacer.html"title="trait regex::bytes::Replacer"><code>Replacer</code></a> trait will work. For example,
a closure of type <code>|&Captures| -> String</code> provides direct access to the
captures corresponding to a match. This allows one to access capturing
) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/alloc/borrow/enum.Cow.html"title="enum alloc::borrow::Cow">Cow</a><'h, [<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]></h4></section></summary><divclass="docblock"><p>Replaces all non-overlapping matches in the haystack with the
replacement provided. This is the same as calling <code>replacen</code> with
<code>limit</code> set to <code>0</code>.</p>
<p>The documentation for <ahref="struct.Regex.html#method.replace"title="method regex::bytes::Regex::replace"><code>Regex::replace</code></a> goes into more detail about
what kinds of replacement strings are supported.</p>
) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/alloc/borrow/enum.Cow.html"title="enum alloc::borrow::Cow">Cow</a><'h, [<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]></h4></section></summary><divclass="docblock"><p>Replaces at most <code>limit</code> non-overlapping matches in the haystack with
the replacement provided. If <code>limit</code> is <code>0</code>, then all non-overlapping
matches are replaced. That is, <code>Regex::replace_all(hay, rep)</code> is
equivalent to <code>Regex::replacen(hay, 0, rep)</code>.</p>
<p>The documentation for <ahref="struct.Regex.html#method.replace"title="method regex::bytes::Regex::replace"><code>Regex::replace</code></a> goes into more detail about
what kinds of replacement strings are supported.</p>
<p>See the corresponding section in the docs for <ahref="struct.Regex.html#method.replace_all"title="method regex::bytes::Regex::replace_all"><code>Regex::replace_all</code></a>
for tips on how to deal with a replacement routine that can fail.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Regex-1"class="impl"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#964-1244">source</a><ahref="#impl-Regex-1"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section></summary><divclass="docblock"><p>A group of advanced or “lower level” search methods. Some methods permit
starting the search at a position greater than <code>0</code> in the haystack. Other
methods permit reusing allocations, for example, when extracting the
matches for capture groups.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.shortest_match"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#994-996">source</a><h4class="code-header">pub fn <ahref="#method.shortest_match"class="fn">shortest_match</a>(&self, haystack: &[<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>></h4></section></summary><divclass="docblock"><p>Returns the end byte offset of the first match in the haystack given.</p>
<p>This method may have the same performance characteristics as
<code>is_match</code>. Behaviorlly, it doesn’t just report whether it match
occurs, but also the end offset for a match. In particular, the offset
returned <em>may be shorter</em> than the proper end of the leftmost-first
match that you would find via <ahref="struct.Regex.html#method.find"title="method regex::bytes::Regex::find"><code>Regex::find</code></a>.</p>
<p>Note that it is not guaranteed that this routine finds the shortest or
“earliest” possible match. Instead, the main idea of this API is that
it returns the offset at the point at which the internal regex engine
has determined that a match has occurred. This may vary depending on
which internal regex engine is used, and thus, the offset itself may
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.shortest_match_at"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1029-1037">source</a><h4class="code-header">pub fn <ahref="#method.shortest_match_at"class="fn">shortest_match_at</a>(&self, haystack: &[<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>], start: <aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>></h4></section></summary><divclass="docblock"><p>Returns the same as <code>shortest_match</code>, but starts the search at the
given offset.</p>
<p>The significance of the starting point is that it takes the surrounding
context into consideration. For example, the <code>\A</code> anchor can only match
when <code>start == 0</code>.</p>
<p>If a match is found, the offset returned is relative to the beginning
of the haystack, not the beginning of the search.</p>
<h5id="panics"><ahref="#panics">Panics</a></h5>
<p>This panics when <code>start >= haystack.len() + 1</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_match_at"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1067-1069">source</a><h4class="code-header">pub fn <ahref="#method.is_match_at"class="fn">is_match_at</a>(&self, haystack: &[<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>], start: <aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns the same as <ahref="struct.Regex.html#method.is_match"title="method regex::bytes::Regex::is_match"><code>Regex::is_match</code></a>, but starts the search at the
given offset.</p>
<p>The significance of the starting point is that it takes the surrounding
context into consideration. For example, the <code>\A</code> anchor can only
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.find_at"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1099-1106">source</a><h4class="code-header">pub fn <ahref="#method.find_at"class="fn">find_at</a><'h>(&self, haystack: &'h [<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>], start: <aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Match.html"title="struct regex::bytes::Match">Match</a><'h>></h4></section></summary><divclass="docblock"><p>Returns the same as <ahref="struct.Regex.html#method.find"title="method regex::bytes::Regex::find"><code>Regex::find</code></a>, but starts the search at the given
offset.</p>
<p>The significance of the starting point is that it takes the surrounding
context into consideration. For example, the <code>\A</code> anchor can only
) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Captures.html"title="struct regex::bytes::Captures">Captures</a><'h>></h4></section></summary><divclass="docblock"><p>Returns the same as <ahref="struct.Regex.html#method.captures"title="method regex::bytes::Regex::captures"><code>Regex::captures</code></a>, but starts the search at the
given offset.</p>
<p>The significance of the starting point is that it takes the surrounding
context into consideration. For example, the <code>\A</code> anchor can only
) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Match.html"title="struct regex::bytes::Match">Match</a><'h>></h4></section></summary><divclass="docblock"><p>This is like <ahref="struct.Regex.html#method.captures"title="method regex::bytes::Regex::captures"><code>Regex::captures</code></a>, but writes the byte offsets of each
capture group match into the locations given.</p>
<p>A <ahref="struct.CaptureLocations.html"title="struct regex::bytes::CaptureLocations"><code>CaptureLocations</code></a> stores the same byte offsets as a <ahref="struct.Captures.html"title="struct regex::bytes::Captures"><code>Captures</code></a>,
but does <em>not</em> store a reference to the haystack. This makes its API
a bit lower level and less convenient. But in exchange, callers
may allocate their own <code>CaptureLocations</code> and reuse it for multiple
searches. This may be helpful if allocating a <code>Captures</code> shows up in a
profile as too costly.</p>
<p>To create a <code>CaptureLocations</code> value, use the
) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Match.html"title="struct regex::bytes::Match">Match</a><'h>></h4></section></summary><divclass="docblock"><p>Returns the same as <ahref="struct.Regex.html#method.captures_read"title="method regex::bytes::Regex::captures_read"><code>Regex::captures_read</code></a>, but starts the search at
the given offset.</p>
<p>The significance of the starting point is that it takes the surrounding
context into consideration. For example, the <code>\A</code> anchor can only
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_str"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1259-1261">source</a><h4class="code-header">pub fn <ahref="#method.as_str"class="fn">as_str</a>(&self) ->&<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a></h4></section></summary><divclass="docblock"><p>Returns the original string of this regex.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.capture_names"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1309-1311">source</a><h4class="code-header">pub fn <ahref="#method.capture_names"class="fn">capture_names</a>(&self) -><aclass="struct"href="struct.CaptureNames.html"title="struct regex::bytes::CaptureNames">CaptureNames</a><'_><ahref="#"class="tooltip"data-notable-ty="CaptureNames<'_>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator over the capture names in this regex.</p>
<p>The iterator returned yields elements of type <code>Option<&str></code>. That is,
the iterator yields values for all capture groups, even ones that are
unnamed. The order of the groups corresponds to the order of the group’s
corresponding opening parenthesis.</p>
<p>The first element of the iterator always yields the group corresponding
to the overall match, and this group is always unnamed. Therefore, the
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.captures_len"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1340-1342">source</a><h4class="code-header">pub fn <ahref="#method.captures_len"class="fn">captures_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the number of captures groups in this regex.</p>
<p>This includes all named and unnamed groups, including the implicit
unnamed group that is always present and corresponds to the entire
match.</p>
<p>Since the implicit unnamed group is always included in this length, the
length returned is guaranteed to be greater than zero.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.static_captures_len"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1380-1382">source</a><h4class="code-header">pub fn <ahref="#method.static_captures_len"class="fn">static_captures_len</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>></h4></section></summary><divclass="docblock"><p>Returns the total number of capturing groups that appear in every
possible match.</p>
<p>If the number of capture groups can vary depending on the match, then
this returns <code>None</code>. That is, a value is only returned when the number
of matching groups is invariant or “static.”</p>
<p>Note that like <ahref="struct.Regex.html#method.captures_len"title="method regex::bytes::Regex::captures_len"><code>Regex::captures_len</code></a>, this <strong>does</strong> include the
implicit capturing group corresponding to the entire match. Therefore,
when a non-None value is returned, it is guaranteed to be at least <code>1</code>.
Stated differently, a return value of <code>Some(0)</code> is impossible.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.capture_locations"class="method"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#1402-1404">source</a><h4class="code-header">pub fn <ahref="#method.capture_locations"class="fn">capture_locations</a>(&self) -><aclass="struct"href="struct.CaptureLocations.html"title="struct regex::bytes::CaptureLocations">CaptureLocations</a></h4></section></summary><divclass="docblock"><p>Returns a fresh allocated set of capture locations that can
be reused in multiple calls to <ahref="struct.Regex.html#method.captures_read"title="method regex::bytes::Regex::captures_read"><code>Regex::captures_read</code></a> or
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-FromStr-for-Regex"class="impl"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#118-125">source</a><ahref="#impl-FromStr-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html"title="trait core::str::traits::FromStr">FromStr</a> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from_str"class="method trait-impl"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#122-124">source</a><ahref="#method.from_str"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#tymethod.from_str"class="fn">from_str</a>(s: &<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a>, <aclass="enum"href="../enum.Error.html"title="enum regex::Error">Error</a>></h4></section></summary><divclass="docblock"><p>Attempts to parse a string into a regular expression</p>
</div></details><detailsclass="toggle"open><summary><sectionid="associatedtype.Err"class="associatedtype trait-impl"><ahref="#associatedtype.Err"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#associatedtype.Err"class="associatedtype">Err</a> = <aclass="enum"href="../enum.Error.html"title="enum regex::Error">Error</a></h4></section></summary><divclass='docblock'>The associated error which can be returned from parsing.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-TryFrom%3C%26str%3E-for-Regex"class="impl"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#127-134">source</a><ahref="#impl-TryFrom%3C%26str%3E-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><&<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from-1"class="method trait-impl"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#131-133">source</a><ahref="#method.try_from-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(s: &<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a>, <aclass="enum"href="../enum.Error.html"title="enum regex::Error">Error</a>></h4></section></summary><divclass="docblock"><p>Attempts to parse a string into a regular expression</p>
</div></details><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="../enum.Error.html"title="enum regex::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-TryFrom%3CString%3E-for-Regex"class="impl"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#136-143">source</a><ahref="#impl-TryFrom%3CString%3E-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><<aclass="struct"href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a>> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="../../src/regex/regex/bytes.rs.html#140-142">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(s: <aclass="struct"href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a>, <aclass="enum"href="../enum.Error.html"title="enum regex::Error">Error</a>></h4></section></summary><divclass="docblock"><p>Attempts to parse a string into a regular expression</p>
</div></details><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="../enum.Error.html"title="enum regex::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details></div></details></div><h2id="synthetic-implementations"class="section-header">Auto Trait Implementations<ahref="#synthetic-implementations"class="anchor">§</a></h2><divid="synthetic-implementations-list"><sectionid="impl-RefUnwindSafe-for-Regex"class="impl"><ahref="#impl-RefUnwindSafe-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html"title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section><sectionid="impl-Send-for-Regex"class="impl"><ahref="#impl-Send-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html"title="trait core::marker::Send">Send</a> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section><sectionid="impl-Sync-for-Regex"class="impl"><ahref="#impl-Sync-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html"title="trait core::marker::Sync">Sync</a> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section><sectionid="impl-Unpin-for-Regex"class="impl"><ahref="#impl-Unpin-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html"title="trait core::marker::Unpin">Unpin</a> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section><sectionid="impl-UnwindSafe-for-Regex"class="impl"><ahref="#impl-UnwindSafe-for-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html"title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <aclass="struct"href="struct.Regex.html"title="struct regex::bytes::Regex">Regex</a></h3></section></div><h2id="blanket-implementations"class="section-header">Blanket Implementations<ahref="#blanket-implementations"class="anchor">§</a></h2><divid="blanket-implementations-list"><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Any-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><ahref="#impl-Any-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html"title="trait core::any::Any">Any</a> for T<divclass="where">where
T: 'static + ?<aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.type_id"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#141">source</a><ahref="#method.type_id"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id"class="fn">type_id</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.76.0/core/any/struct.TypeId.html"title="struct core::any::TypeId">TypeId</a></h4></section></summary><divclass='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <ahref="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Borrow%3CT%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#208">source</a><ahref="#impl-Borrow%3CT%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html"title="trait core::borrow::Borrow">Borrow</a><T> for T<divclass="where">where
T: ?<aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#210">source</a><ahref="#method.borrow"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow"class="fn">borrow</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&T</a></h4></section></summary><divclass='docblock'>Immutably borrows from an owned value. <ahref="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-BorrowMut%3CT%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#216">source</a><ahref="#impl-BorrowMut%3CT%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html"title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<divclass="where">where
T: ?<aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow_mut"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#217">source</a><ahref="#method.borrow_mut"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut"class="fn">borrow_mut</a>(&mut self) -><aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&mut T</a></h4></section></summary><divclass='docblock'>Mutably borrows from an owned value. <ahref="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-From%3CT%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#763">source</a><ahref="#impl-From%3CT%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#766">source</a><ahref="#method.from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from"class="fn">from</a>(t: T) -> T</h4></section></summary><divclass="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Into%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#747-749">source</a><ahref="#impl-Into%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><U> for T<divclass="where">where
<p>That is, this conversion is whatever the implementation of
<code><ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToOwned-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#83-85">source</a><ahref="#impl-ToOwned-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Owned"class="associatedtype trait-impl"><ahref="#associatedtype.Owned"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="associatedtype">Owned</a> = T</h4></section></summary><divclass='docblock'>The resulting type after obtaining ownership.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_owned"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#88">source</a><ahref="#method.to_owned"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fn">to_owned</a>(&self) -> T</h4></section></summary><divclass='docblock'>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#92">source</a><ahref="#method.clone_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><divclass='docblock'>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToString-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/string.rs.html#2600">source</a><ahref="#impl-ToString-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html"title="trait alloc::string::ToString">ToString</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Display.html"title="trait core::fmt::Display">Display</a> + ?<aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_string"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/string.rs.html#2606">source</a><ahref="#method.to_string"class="anchor">§</a><h4class="code-header">default fn <ahref="https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html#tymethod.to_string"class="fn">to_string</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a></h4></section></summary><divclass='docblock'>Converts the given value to a <code>String</code>. <ahref="https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">source</a><ahref="#impl-TryFrom%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-2"class="associatedtype trait-impl"><ahref="#associatedtype.Error-2"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from-2"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><ahref="#method.try_from-2"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">source</a><ahref="#impl-TryInto%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-3"class="associatedtype trait-impl"><ahref="#associatedtype.Error-3"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div><scripttype="text/json"id="notable-traits-data">{"CaptureMatches<'r,'h>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.CaptureMatches.html\"title=\"structregex::bytes::CaptureMatches\">CaptureMatches</a><'r,'h></code></h3><pre><code><divclass=\"where\">impl<'r,'h><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"struct.CaptureMatches.html\"title=\"structregex::bytes::CaptureMatches\">CaptureMatches</a><'r,'h></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=\"associatedtype\">Item</a>=<aclass=\"struct\"href=\"struct.Captures.html\"title=\"structregex::bytes::Captures\">Captures</a><'h>;</div>","CaptureNames<'_>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.CaptureNames.html\"title=\"structregex::bytes::CaptureNames\">CaptureNames</a><'r></code></h3><pre><code><divclass=\"where\">impl<'r><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"struct.CaptureNames.html\"title=\"structregex::bytes::CaptureNames\">CaptureNames</a><'r></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=\"associatedtype\">Item</a>=<aclass=\"enum\"href=\"https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html\"title=\"enumcore::option::Option\">Option</a><&'r<aclass=\"primitive\"href=\"https://doc.rust-lang.org/1.76.0/std/primitive.str.html\">str</a>>;</div>","Matches<'r,'h>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.Matches.html\"title=\"structregex::bytes::Matches\">Matches</a><'r,'h></code></h3><pre><code><divclass=\"where\">impl<'r,'h&