<!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 regex matcher that works by composing several other regex matchers automatically."><title>Regex in regex_automata::meta - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><linkrel="stylesheet"href="../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../static.files/rustdoc-dd39b87e5fcfba68.css"><metaname="rustdoc-vars"data-root-path="../../"data-static-root-path="../../static.files/"data-current-crate="regex_automata"data-themes=""data-resource-suffix=""data-rustdoc-version="1.80.0 (051478957 2024-07-21)"data-channel="1.80.0"data-search-js="search-d52510db62a78183.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../../static.files/storage-118b08c4c78b968e.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><linkrel="stylesheet"href="../../static.files/noscript-df360f571f6edeae.css"></noscript><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"title="show sidebar"></button></nav><navclass="sidebar"><divclass="sidebar-crate"><h2><ahref="../../regex_automata/index.html">regex_automata</a><spanclass="version">0.4.7</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.builder">builder</a></li><li><ahref="#method.captures">captures</a></li><li><ahref="#method.captures_iter">captures_iter</a></li><li><ahref="#method.captures_len">captures_len</a></li><li><ahref="#method.config">config</a></li><li><ahref="#method.create_cache">create_cache</a></li><li><ahref="#method.create_captures">create_captures</a></li><li><ahref="#method.find">find</a></li><li><ahref="#method.find_iter">find_iter</a></li><li><ahref="#method.get_config">get_config</a></li><li><ahref="#method.group_info">group_info</a></li><li><ahref="#method.is_accelerated">is_accelerated</a></li><li><ahref="#method.is_match">is_match</a></li><li><ahref="#method.memory_usage">memory_usage</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.new_many">new_many</a></li><li><ahref="#method.pattern_len">pattern_len</a></li><li><ahref="#method.search">search</a></li><li><ahref="#method.search_captures">search_captures</a></li><li><ahref="#method.search_captures_with">search_captures_with</a></li><li><ahref="#method.search_half">search_half</a></li><li><ahref="#method.search_half_with">search_half_with</a></li><li><ahref="#method.search_slots">search_slots</a></li><li><ahref="#method.search_slots_with">search_slots_with</a></li><li><ahref="#method.search_with">search_with</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><li><ahref="#method.which_overlapping_matches">which_overlapping_matches</a></li><li><ahref="#method.which_overlapping_matches_with">which_overlapping_matches_with</a></li></ul><h3><ahref="#trait-implementations">Trait Implementations</a></h3><u
<p>This is called a “meta” matcher precisely because it uses other regex
matchers to provide a convenient high level regex API. Here are some
examples of how other regex matchers are composed:</p>
<ul>
<li>When calling <ahref="struct.Regex.html#method.captures"title="method regex_automata::meta::Regex::captures"><code>Regex::captures</code></a>, instead of immediately
running a slower but more capable regex engine like the
<ahref="../nfa/thompson/pikevm/struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM"><code>PikeVM</code></a>, the meta regex engine
will usually first look for the bounds of a match with a higher throughput
is a slower engine like <code>PikeVM</code> used to find the matching span for each
capture group.</li>
<li>While higher throughout engines like the lazy DFA cannot handle
Unicode word boundaries in general, they can still be used on pure ASCII
haystacks by pretending that Unicode word boundaries are just plain ASCII
word boundaries. However, if a haystack is not ASCII, the meta regex engine
will automatically switch to a (possibly slower) regex engine that supports
Unicode word boundaries in general.</li>
<li>In some cases where a regex pattern is just a simple literal or a small
set of literals, an actual regex engine won’t be used at all. Instead,
substring or multi-substring search algorithms will be employed.</li>
</ul>
<p>There are many other forms of composition happening too, but the above
should give a general idea. In particular, it may perhaps be surprising
that <em>multiple</em> regex engines might get executed for a single search. That
is, the decision of what regex engine to use is not <em>just</em> based on the
pattern, but also based on the dynamic execution of the search itself.</p>
<p>The primary reason for this composition is performance. The fundamental
tension is that the faster engines tend to be less capable, and the more
capable engines tend to be slower.</p>
<p>Note that the forms of composition that are allowed are determined by
compile time crate features and configuration. For example, if the <code>hybrid</code>
feature isn’t enabled, or if <ahref="struct.Config.html#method.hybrid"title="method regex_automata::meta::Config::hybrid"><code>Config::hybrid</code></a> has been disabled, then the
<p>Most of the regex engines in this crate require some kind of mutable
“scratch” space to read and write from while performing a search. Since
a meta regex composes these regex engines, a meta regex also requires
mutable scratch space. This scratch space is called a <ahref="struct.Cache.html"title="struct regex_automata::meta::Cache"><code>Cache</code></a>.</p>
<p>Most regex engines <em>also</em> usually have a read-only component, typically
a <ahref="../nfa/thompson/struct.NFA.html"title="struct regex_automata::nfa::thompson::NFA">Thompson <code>NFA</code></a>.</p>
<p>In order to make the <code>Regex</code> API convenient, most of the routines hide
the fact that a <code>Cache</code> is needed at all. To achieve this, a <ahref="../util/pool/struct.Pool.html"title="struct regex_automata::util::pool::Pool">memory
pool</a> is used internally to retrieve <code>Cache</code>
values in a thread safe way that also permits reuse. This in turn implies
that every such search call requires some form of synchronization. Usually
this synchronization is fast enough to not notice, but in some cases, it
can be a bottleneck. This typically occurs when all of the following are
true:</p>
<ul>
<li>The same <code>Regex</code> is shared across multiple threads simultaneously,
usually via a <ahref="../util/lazy/struct.Lazy.html"title="struct regex_automata::util::lazy::Lazy"><code>util::lazy::Lazy</code></a> or something
similar from the <code>once_cell</code> or <code>lazy_static</code> crates.</li>
<li>The primary unit of work in each thread is a regex search.</li>
<li>Searches are run on very short haystacks.</li>
</ul>
<p>This particular case can lead to high contention on the pool used by a
<code>Regex</code> internally, which can in turn increase latency to a noticeable
effect. This cost can be mitigated in one of the following ways:</p>
<ul>
<li>Use a distinct copy of a <code>Regex</code> in each thread, usually by cloning it.
Cloning a <code>Regex</code><em>does not</em> do a deep copy of its read-only component.
But it does lead to each <code>Regex</code> having its own memory pool, which in
turn eliminates the problem of contention. In general, this technique should
not result in any additional memory usage when compared to sharing the same
<code>Regex</code> across multiple threads simultaneously.</li>
<li>Use lower level APIs, like <ahref="struct.Regex.html#method.search_with"title="method regex_automata::meta::Regex::search_with"><code>Regex::search_with</code></a>, which permit passing
a <code>Cache</code> explicitly. In this case, it is up to you to determine how best
to provide a <code>Cache</code>. For example, you might put a <code>Cache</code> in thread-local
storage if your use case allows for it.</li>
</ul>
<p>Overall, this is an issue that happens rarely in practice, but it can
<h2id="warning-spin-locks-may-be-used-in-alloc-only-mode"><aclass="doc-anchor"href="#warning-spin-locks-may-be-used-in-alloc-only-mode">§</a>Warning: spin-locks may be used in alloc-only mode</h2>
<p>When this crate is built without the <code>std</code> feature and the high level APIs
on a <code>Regex</code> are used, then a spin-lock will be used to synchronize access
to an internal pool of <code>Cache</code> values. This may be undesirable because
a spin-lock is <ahref="https://matklad.github.io/2020/01/02/spinlocks-considered-harmful.html">effectively impossible to implement correctly in user
space</a>. That is, more concretely, the spin-lock could
result in a deadlock.</p>
<p>If one wants to avoid the use of spin-locks when the <code>std</code> feature is
disabled, then you must use APIs that accept a <code>Cache</code> value explicitly.
For example, <ahref="struct.Regex.html#method.search_with"title="method regex_automata::meta::Regex::search_with"><code>Regex::search_with</code></a>.</p>
<p>This example shows how to use <ahref="../struct.Input.html#method.anchored"title="method regex_automata::Input::anchored"><code>Input::anchored</code></a> to run an anchored
search, even when the regex pattern itself isn’t anchored. An anchored
search guarantees that if a match is found, then the start offset of the
match corresponds to the offset at which the search was started.</p>
<p>This example shows how to use <ahref="../struct.Input.html#method.earliest"title="method regex_automata::Input::earliest"><code>Input::earliest</code></a> to run a search that
might stop before finding the typical leftmost match.</p>
<h2id="example-change-the-line-terminator"><aclass="doc-anchor"href="#example-change-the-line-terminator">§</a>Example: change the line terminator</h2>
</div></details><h2id="implementations"class="section-header">Implementations<ahref="#implementations"class="anchor">§</a></h2><divid="implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Regex"class="impl"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#281-450">source</a><ahref="#impl-Regex"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Regex.html"title="struct regex_automata::meta::Regex">Regex</a></h3></section></summary><divclass="docblock"><p>Convenience constructors for a <code>Regex</code> using the default configuration.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.new"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#302-304">source</a><h4class="code-header">pub fn <ahref="#method.new"class="fn">new</a>(pattern: &<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.Regex.html"title="struct regex_automata::meta::Regex">Regex</a>, <aclass="struct"href="struct.BuildError.html"title="struct regex_automata::meta::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Builds a <code>Regex</code> from a single pattern string using the default
<p>If there was a problem parsing the pattern or a problem turning it into
a regex matcher, then an error is returned.</p>
<p>If you want to change the configuration of a <code>Regex</code>, use a <ahref="struct.Builder.html"title="struct regex_automata::meta::Builder"><code>Builder</code></a>
with a <ahref="struct.Config.html"title="struct regex_automata::meta::Config"><code>Config</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.new_many"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#393-397">source</a><h4class="code-header">pub fn <ahref="#method.new_many"class="fn">new_many</a><P: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>>>(patterns: &<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html">[P]</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.Regex.html"title="struct regex_automata::meta::Regex">Regex</a>, <aclass="struct"href="struct.BuildError.html"title="struct regex_automata::meta::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Builds a <code>Regex</code> from many pattern strings using the default
<p>If there was a problem parsing any of the patterns or a problem turning
them into a regex matcher, then an error is returned.</p>
<p>If you want to change the configuration of a <code>Regex</code>, use a <ahref="struct.Builder.html"title="struct regex_automata::meta::Builder"><code>Builder</code></a>
with a <ahref="struct.Config.html"title="struct regex_automata::meta::Config"><code>Config</code></a>.</p>
<h5id="example-finding-the-pattern-that-caused-an-error"><aclass="doc-anchor"href="#example-finding-the-pattern-that-caused-an-error">§</a>Example: finding the pattern that caused an error</h5>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.config"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#421-423">source</a><h4class="code-header">pub fn <ahref="#method.config"class="fn">config</a>() -><aclass="struct"href="struct.Config.html"title="struct regex_automata::meta::Config">Config</a></h4></section></summary><divclass="docblock"><p>Return a default configuration for a <code>Regex</code>.</p>
<p>This is a convenience routine to avoid needing to import the <ahref="struct.Config.html"title="struct regex_automata::meta::Config"><code>Config</code></a>
type when customizing the construction of a <code>Regex</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.builder"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#447-449">source</a><h4class="code-header">pub fn <ahref="#method.builder"class="fn">builder</a>() -><aclass="struct"href="struct.Builder.html"title="struct regex_automata::meta::Builder">Builder</a></h4></section></summary><divclass="docblock"><p>Return a builder for configuring the construction of a <code>Regex</code>.</p>
<p>This is a convenience routine to avoid needing to import the
<ahref="struct.Builder.html"title="struct regex_automata::meta::Builder"><code>Builder</code></a> type in common cases.</p>
<h5id="example-change-the-line-terminator-1"><aclass="doc-anchor"href="#example-change-the-line-terminator-1">§</a>Example: change the line terminator</h5>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Regex-1"class="impl"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#453-895">source</a><ahref="#impl-Regex-1"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Regex.html"title="struct regex_automata::meta::Regex">Regex</a></h3></section></summary><divclass="docblock"><p>High level convenience routines for using a regex to search a haystack.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_match"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#530-540">source</a><h4class="code-header">pub fn <ahref="#method.is_match"class="fn">is_match</a><'h, I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'h>>>(&self, input: I) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true if and only if this regex matches the given haystack.</p>
<h5id="example-consistency-with-search-apis"><aclass="doc-anchor"href="#example-consistency-with-search-apis">§</a>Example: consistency with search APIs</h5>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.find"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#556-558">source</a><h4class="code-header">pub fn <ahref="#method.find"class="fn">find</a><'h, I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'h>>>(&self, input: I) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../struct.Match.html"title="struct regex_automata::Match">Match</a>></h4></section></summary><divclass="docblock"><p>Executes a leftmost search and returns the first match that is found,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.captures"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#582-588">source</a><h4class="code-header">pub fn <ahref="#method.captures"class="fn">captures</a><'h, I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'h>>>(&self, input: I, caps: &mut <aclass="struct"href="../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures">Captures</a>)</h4></section></summary><divclass="docblock"><p>Executes a leftmost forward search and writes the spans of capturing
groups that participated in a match into the provided <ahref="../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures"><code>Captures</code></a>
value. If no match was found, then <ahref="../util/captures/struct.Captures.html#method.is_match"title="method regex_automata::util::captures::Captures::is_match"><code>Captures::is_match</code></a> is guaranteed
) -><aclass="struct"href="struct.FindMatches.html"title="struct regex_automata::meta::FindMatches">FindMatches</a><'r, 'h><ahref="#"class="tooltip"data-notable-ty="FindMatches<'r, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator over all non-overlapping leftmost matches in
the given haystack. If no match exists, then the iterator yields no
) -><aclass="struct"href="struct.CapturesMatches.html"title="struct regex_automata::meta::CapturesMatches">CapturesMatches</a><'r, 'h><ahref="#"class="tooltip"data-notable-ty="CapturesMatches<'r, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator over all non-overlapping <code>Captures</code> values. If no
match exists, then the iterator yields no elements.</p>
<p>This yields the same matches as <ahref="struct.Regex.html#method.find_iter"title="method regex_automata::meta::Regex::find_iter"><code>Regex::find_iter</code></a>, but it includes
the spans of all capturing groups that participate in each match.</p>
<p><strong>Tip:</strong> See <ahref="../util/iter/struct.Searcher.html"title="struct regex_automata::util::iter::Searcher"><code>util::iter::Searcher</code></a> for
how to correctly iterate over all matches in a haystack while avoiding
the creation of a new <code>Captures</code> value for every match. (Which you are
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#815-820">source</a><h4class="code-header">pub fn <ahref="#method.split"class="fn">split</a><'r, 'h, I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'h>>>(&'r self, input: I) -><aclass="struct"href="struct.Split.html"title="struct regex_automata::meta::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 spans of the haystack given, delimited by a
) -><aclass="struct"href="struct.SplitN.html"title="struct regex_automata::meta::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> spans of the haystack given,
delimited by a match of the regex. (A <code>limit</code> of <code>0</code> will return no
spans.) 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 element in
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Regex-2"class="impl"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#898-1204">source</a><ahref="#impl-Regex-2"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Regex.html"title="struct regex_automata::meta::Regex">Regex</a></h3></section></summary><divclass="docblock"><p>Lower level search routines that give more control.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.search"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#919-945">source</a><h4class="code-header">pub fn <ahref="#method.search"class="fn">search</a>(&self, input: &<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'_>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../struct.Match.html"title="struct regex_automata::Match">Match</a>></h4></section></summary><divclass="docblock"><p>Returns the start and end offset of the leftmost match. If no match
<p>This is like <ahref="struct.Regex.html#method.find"title="method regex_automata::meta::Regex::find"><code>Regex::find</code></a> but, but it accepts a concrete <code>&Input</code>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.search_half"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#975-984">source</a><h4class="code-header">pub fn <ahref="#method.search_half"class="fn">search_half</a>(&self, input: &<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'_>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../struct.HalfMatch.html"title="struct regex_automata::HalfMatch">HalfMatch</a>></h4></section></summary><divclass="docblock"><p>Returns the end offset of the leftmost match. If no match exists, then
<p>This is distinct from <ahref="struct.Regex.html#method.search"title="method regex_automata::meta::Regex::search"><code>Regex::search</code></a> in that it only returns the end
of a match and not the start of the match. Depending on a variety of
implementation details, this <em>may</em> permit the regex engine to do less
overall work. For example, if a DFA is being used to execute a search,
then the start of a match usually requires running a separate DFA in
reverse to the find the start of a match. If one only needs the end of
a match, then the separate reverse scan to find the start of a match
can be skipped. (Note that the reverse scan is avoided even when using
<code>Regex::search</code> when possible, for example, in the case of an anchored
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.search_captures"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1063-1067">source</a><h4class="code-header">pub fn <ahref="#method.search_captures"class="fn">search_captures</a>(&self, input: &<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'_>, caps: &mut <aclass="struct"href="../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures">Captures</a>)</h4></section></summary><divclass="docblock"><p>Executes a leftmost forward search and writes the spans of capturing
groups that participated in a match into the provided <ahref="../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures"><code>Captures</code></a>
value. If no match was found, then <ahref="../util/captures/struct.Captures.html#method.is_match"title="method regex_automata::util::captures::Captures::is_match"><code>Captures::is_match</code></a> is guaranteed
to return <code>false</code>.</p>
<p>This is like <ahref="struct.Regex.html#method.captures"title="method regex_automata::meta::Regex::captures"><code>Regex::captures</code></a>, but it accepts a concrete <code>&Input</code>
<h5id="example-specifying-the-bounds-of-a-search"><aclass="doc-anchor"href="#example-specifying-the-bounds-of-a-search">§</a>Example: specifying the bounds of a search</h5>
) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../struct.PatternID.html"title="struct regex_automata::PatternID">PatternID</a>></h4></section></summary><divclass="docblock"><p>Executes a leftmost forward search and writes the spans of capturing
groups that participated in a match into the provided <code>slots</code>, and
returns the matching pattern ID. The contents of the slots for patterns
other than the matching pattern are unspecified. If no match was found,
then <code>None</code> is returned and the contents of <code>slots</code> is unspecified.</p>
<p>This is like <ahref="struct.Regex.html#method.search"title="method regex_automata::meta::Regex::search"><code>Regex::search</code></a>, but it accepts a raw slots slice
instead of a <code>Captures</code> value. This is useful in contexts where you
don’t want or need to allocate a <code>Captures</code>.</p>
<p>It is legal to pass <em>any</em> number of slots to this routine. If the regex
engine would otherwise write a slot offset that doesn’t fit in the
provided slice, then it is simply skipped. In general though, there are
usually three slice lengths you might want to use:</p>
<ul>
<li>An empty slice, if you only care about which pattern matched.</li>
<li>A slice with <ahref="struct.Regex.html#method.pattern_len"title="method regex_automata::meta::Regex::pattern_len"><code>pattern_len() * 2</code></a> slots, if you
only care about the overall match spans for each matching pattern.</li>
<li>A slice with
<ahref="../util/captures/struct.GroupInfo.html#method.slot_len"title="method regex_automata::util::captures::GroupInfo::slot_len"><code>slot_len()</code></a> slots, which
permits recording match offsets for every capturing group in every
)</h4></section></summary><divclass="docblock"><p>Writes the set of patterns that match anywhere in the given search
configuration to <code>patset</code>. If multiple patterns match at the same
position and this <code>Regex</code> was configured with <ahref="../enum.MatchKind.html#variant.All"title="variant regex_automata::MatchKind::All"><code>MatchKind::All</code></a>
semantics, then all matching patterns are written to the given set.</p>
<p>Unless all of the patterns in this <code>Regex</code> are anchored, then generally
speaking, this will scan the entire haystack.</p>
<p>This search routine <em>does not</em> clear the pattern set. This gives some
flexibility to the caller (e.g., running multiple searches with the
same pattern set), but does make the API bug-prone if you’re reusing
the same pattern set for multiple searches but intended them to be
independent.</p>
<p>If a pattern ID matched but the given <code>PatternSet</code> does not have
sufficient capacity to store it, then it is not inserted and silently
<p>This example shows how to find all matching patterns in a haystack,
even when some patterns match at the same position as other patterns.
It is important that we configure the <code>Regex</code> with <ahref="../enum.MatchKind.html#variant.All"title="variant regex_automata::MatchKind::All"><code>MatchKind::All</code></a>
semantics here, or else overlapping matches will not be reported.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Regex-3"class="impl"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1208-1494">source</a><ahref="#impl-Regex-3"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Regex.html"title="struct regex_automata::meta::Regex">Regex</a></h3></section></summary><divclass="docblock"><p>Lower level search routines that give more control, and require the caller
to provide an explicit <ahref="struct.Cache.html"title="struct regex_automata::meta::Cache"><code>Cache</code></a> parameter.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.search_with"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1240-1249">source</a><h4class="code-header">pub fn <ahref="#method.search_with"class="fn">search_with</a>(&self, cache: &mut <aclass="struct"href="struct.Cache.html"title="struct regex_automata::meta::Cache">Cache</a>, input: &<aclass="struct"href="../struct.Input.html"title="struct regex_automata::Input">Input</a><'_>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../struct.Match.html"title="struct regex_automata::Match">Match</a>></h4></section></summary><divclass="docblock"><p>This is like <ahref="struct.Regex.html#method.search"title="method regex_automata::meta::Regex::search"><code>Regex::search</code></a>, but requires the caller to
) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../struct.HalfMatch.html"title="struct regex_automata::HalfMatch">HalfMatch</a>></h4></section></summary><divclass="docblock"><p>This is like <ahref="struct.Regex.html#method.search_half"title="method regex_automata::meta::Regex::search_half"><code>Regex::search_half</code></a>, but requires the caller to
)</h4></section></summary><divclass="docblock"><p>This is like <ahref="struct.Regex.html#method.search_captures"title="method regex_automata::meta::Regex::search_captures"><code>Regex::search_captures</code></a>, but requires the caller to
explicitly pass a <ahref="struct.Cache.html"title="struct regex_automata::meta::Cache"><code>Cache</code></a>.</p>
<h5id="example-specifying-the-bounds-of-a-search-1"><aclass="doc-anchor"href="#example-specifying-the-bounds-of-a-search-1">§</a>Example: specifying the bounds of a search</h5>
) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../struct.PatternID.html"title="struct regex_automata::PatternID">PatternID</a>></h4></section></summary><divclass="docblock"><p>This is like <ahref="struct.Regex.html#method.search_slots"title="method regex_automata::meta::Regex::search_slots"><code>Regex::search_slots</code></a>, but requires the caller to
)</h4></section></summary><divclass="docblock"><p>This is like <ahref="struct.Regex.html#method.which_overlapping_matches"title="method regex_automata::meta::Regex::which_overlapping_matches"><code>Regex::which_overlapping_matches</code></a>, but requires the
caller to explicitly pass a <ahref="struct.Cache.html"title="struct regex_automata::meta::Cache"><code>Cache</code></a>.</p>
<p>Passing a <code>Cache</code> explicitly will bypass the use of an internal memory
pool used by <code>Regex</code> to get a <code>Cache</code> for a search. The use of this
pool can be slower in some cases when a <code>Regex</code> is used from multiple
threads simultaneously. Typically, performance only becomes an issue
when there is heavy contention, which in turn usually only occurs
when each thread’s primary unit of work is a regex search on a small
<h5id="why-pass-a-cache-explicitly-4"><aclass="doc-anchor"href="#why-pass-a-cache-explicitly-4">§</a>Why pass a <code>Cache</code> explicitly?</h5><h5id="example-16"><aclass="doc-anchor"href="#example-16">§</a>Example</h5>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Regex-4"class="impl"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1498-1897">source</a><ahref="#impl-Regex-4"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Regex.html"title="struct regex_automata::meta::Regex">Regex</a></h3></section></summary><divclass="docblock"><p>Various non-search routines for querying properties of a <code>Regex</code> and
convenience routines for creating <ahref="../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures"><code>Captures</code></a> and <ahref="struct.Cache.html"title="struct regex_automata::meta::Cache"><code>Cache</code></a> values.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.create_captures"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1558-1560">source</a><h4class="code-header">pub fn <ahref="#method.create_captures"class="fn">create_captures</a>(&self) -><aclass="struct"href="../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures">Captures</a></h4></section></summary><divclass="docblock"><p>Creates a new object for recording capture group offsets. This is used
in search APIs like <ahref="struct.Regex.html#method.captures"title="method regex_automata::meta::Regex::captures"><code>Regex::captures</code></a> and <ahref="struct.Regex.html#method.search_captures"title="method regex_automata::meta::Regex::search_captures"><code>Regex::search_captures</code></a>.</p>
<p>This is a convenience routine for
<code>Captures::all(re.group_info().clone())</code>. Callers may build other types
of <code>Captures</code> values that record less information (and thus require
less work from the regex engine) using <ahref="../util/captures/struct.Captures.html#method.matches"title="associated function regex_automata::util::captures::Captures::matches"><code>Captures::matches</code></a> and
<ahref="../util/captures/struct.Captures.html#method.empty"title="associated function regex_automata::util::captures::Captures::empty"><code>Captures::empty</code></a>.</p>
<p>This shows some alternatives to <ahref="struct.Regex.html#method.create_captures"title="method regex_automata::meta::Regex::create_captures"><code>Regex::create_captures</code></a>:</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.create_cache"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1586-1588">source</a><h4class="code-header">pub fn <ahref="#method.create_cache"class="fn">create_cache</a>(&self) -><aclass="struct"href="struct.Cache.html"title="struct regex_automata::meta::Cache">Cache</a></h4></section></summary><divclass="docblock"><p>Creates a new cache for use with lower level search APIs like
<p>The cache returned should only be used for searches for this <code>Regex</code>.
If you want to reuse the cache for another <code>Regex</code>, then you must call
<ahref="struct.Cache.html#method.reset"title="method regex_automata::meta::Cache::reset"><code>Cache::reset</code></a> with that <code>Regex</code>.</p>
<p>This is a convenience routine for <ahref="struct.Cache.html#method.new"title="associated function regex_automata::meta::Cache::new"><code>Cache::new</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.pattern_len"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1616-1618">source</a><h4class="code-header">pub fn <ahref="#method.pattern_len"class="fn">pattern_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the total number of patterns in this regex.</p>
<p>The standard <ahref="struct.Regex.html#method.new"title="associated function regex_automata::meta::Regex::new"><code>Regex::new</code></a> constructor always results in a <code>Regex</code>
with a single pattern, but <ahref="struct.Regex.html#method.new_many"title="associated function regex_automata::meta::Regex::new_many"><code>Regex::new_many</code></a> permits building a
multi-pattern regex.</p>
<p>A <code>Regex</code> guarantees that the maximum possible <code>PatternID</code> returned in
any match is <code>Regex::pattern_len() - 1</code>. In the case where the number
of patterns is <code>0</code>, a match is impossible.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.captures_len"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1671-1677">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.80.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the total number of capturing groups.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.static_captures_len"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1740-1746">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.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>></h4></section></summary><divclass="docblock"><p>Returns the total number of capturing groups that appear in every
<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_automata::meta::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.group_info"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1812-1814">source</a><h4class="code-header">pub fn <ahref="#method.group_info"class="fn">group_info</a>(&self) ->&<aclass="struct"href="../util/captures/struct.GroupInfo.html"title="struct regex_automata::util::captures::GroupInfo">GroupInfo</a></h4></section></summary><divclass="docblock"><p>Return information about the capture groups in this <code>Regex</code>.</p>
<p>A <code>GroupInfo</code> is an immutable object that can be cheaply cloned. It
is responsible for maintaining a mapping between the capture groups
in the concrete syntax of zero or more regex patterns and their
internal representation used by some of the regex matchers. It is also
responsible for maintaining a mapping between the name of each group
(if one exists) and its corresponding group index.</p>
<p>A <code>GroupInfo</code> is ultimately what is used to build a <ahref="../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures"><code>Captures</code></a> value,
which is some mutable space where group offsets are stored as a result
<p>This shows some alternatives to <ahref="struct.Regex.html#method.create_captures"title="method regex_automata::meta::Regex::create_captures"><code>Regex::create_captures</code></a>:</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_config"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1821-1823">source</a><h4class="code-header">pub fn <ahref="#method.get_config"class="fn">get_config</a>(&self) ->&<aclass="struct"href="struct.Config.html"title="struct regex_automata::meta::Config">Config</a></h4></section></summary><divclass="docblock"><p>Returns the configuration object used to build this <code>Regex</code>.</p>
<p>If no configuration object was explicitly passed, then the
configuration returned represents the default.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_accelerated"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1872-1874">source</a><h4class="code-header">pub fn <ahref="#method.is_accelerated"class="fn">is_accelerated</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true if this regex has a high chance of being “accelerated.”</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.memory_usage"class="method"><aclass="src rightside"href="../../src/regex_automata/meta/regex.rs.html#1894-1896">source</a><h4class="code-header">pub fn <ahref="#method.memory_usage"class="fn">memory_usage</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Return the total approximate heap memory, in bytes, used by this <code>Regex</code>.</p>
<p>Note that currently, there is no high level configuration for setting
a limit on the specific value returned by this routine. Instead, the
following routines can be used to control heap memory at a bit of a
lower level:</p>
<ul>
<li><ahref="struct.Config.html#method.nfa_size_limit"title="method regex_automata::meta::Config::nfa_size_limit"><code>Config::nfa_size_limit</code></a> controls how big <em>any</em> of the NFAs are
allowed to be.</li>
<li><ahref="struct.Config.html#method.onepass_size_limit"title="method regex_automata::meta::Config::onepass_size_limit"><code>Config::onepass_size_limit</code></a> controls how big the one-pass DFA is
allowed to be.</li>
<li><ahref="struct.Config.html#method.hybrid_cache_capacity"title="method regex_automata::meta::Config::hybrid_cache_capacity"><code>Config::hybrid_cache_capacity</code></a> controls how much memory the lazy
DFA is permitted to allocate to store its transition table.</li>
<li><ahref="struct.Config.html#method.dfa_size_limit"title="method regex_automata::meta::Config::dfa_size_limit"><code>Config::dfa_size_limit</code></a> controls how big a fully compiled DFA is
allowed to be.</li>
<li><ahref="struct.Config.html#method.dfa_state_limit"title="method regex_automata::meta::Config::dfa_state_limit"><code>Config::dfa_state_limit</code></a> controls the conditions under which the
meta regex engine will even attempt to build a fully compiled DFA.</li>
<code><ahref="https://doc.rust-lang.org/1.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into">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.80.0/src/core/convert/mod.rs.html#805-807">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.80.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.80.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"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.80.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"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#812">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.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.80.0/src/core/convert/mod.rs.html#790-792">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.80.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.80.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-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.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.80.0/src/core/convert/mod.rs.html#797">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.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">{"CapturesMatches<'r,'h>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.CapturesMatches.html\"title=\"structregex_automata::meta::CapturesMatches\">CapturesMatches</a><'r,'h></code></h3><pre><code><divclass=\"where\">impl<'r,'h><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"struct.CapturesMatches.html\"title=\"structregex_automata::meta::CapturesMatches\">CapturesMatches</a><'r,'h></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=\"associatedtype\">Item</a>=<aclass=\"struct\"href=\"../util/captures/struct.Captures.html\"title=\"structregex_automata::util::captures::Captures\">Captures</a>;</div>","FindMatches<'r,'h>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.FindMatches.html\"title=\"structregex_automata::meta::FindMatches\">FindMatches</a><'r,'h></code></h3><pre><code><divclass=\"where\">impl<'r,'h><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"struct.FindMatches.html\"title=\"structregex_automata::meta::FindMatches\">FindMatches</a><'r,'h></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=\"associatedtype\">Item</a>=<aclass=\"struct\"href=\"../struct.Match.html\"title=\"structregex_automata::Match\">Match</a>;</div>","Split<'r,'h>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.Split.html\"title=\"structregex_automata::meta::Split\">Split</a><'r,'h></code></h3><pre><code><divclass=\"where\">impl<'r,'h><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/tr