owoify/target/doc/regex/struct.Regex.html

324 lines
76 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Regex` struct in crate `regex`."><meta name="keywords" content="rust, rustlang, rust-lang, Regex"><title>regex::Regex - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../regex/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Regex</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.as_str">as_str</a><a href="#method.capture_locations">capture_locations</a><a href="#method.capture_names">capture_names</a><a href="#method.captures">captures</a><a href="#method.captures_iter">captures_iter</a><a href="#method.captures_len">captures_len</a><a href="#method.captures_read">captures_read</a><a href="#method.captures_read_at">captures_read_at</a><a href="#method.find">find</a><a href="#method.find_at">find_at</a><a href="#method.find_iter">find_iter</a><a href="#method.is_match">is_match</a><a href="#method.is_match_at">is_match_at</a><a href="#method.new">new</a><a href="#method.replace">replace</a><a href="#method.replace_all">replace_all</a><a href="#method.replacen">replacen</a><a href="#method.shortest_match">shortest_match</a><a href="#method.shortest_match_at">shortest_match_at</a><a href="#method.split">split</a><a href="#method.splitn">splitn</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-FromStr">FromStr</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='index.html'>regex</a></p><script>window.sidebarCurrent = {name: 'Regex', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/regex/re_unicode.rs.html#137' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>regex</a>::<wbr><a class="struct" href=''>Regex</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Regex(_);</pre></div><div class='docblock'><p>A compiled regular expression for matching Unicode strings.</p>
<p>It is represented as either a sequence of bytecode instructions (dynamic)
or as a specialized Rust function (native). It can be used to search, split
or replace text. All searching is done with an implicit <code>.*?</code> at the
beginning and end of an expression. 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>While this crate will handle Unicode strings (whether in the regular
expression or in the search text), all positions returned are <strong>byte
indices</strong>. Every byte index is guaranteed to be at a Unicode code point
boundary.</p>
<p>The lifetimes <code>'r</code> and <code>'t</code> in this crate correspond to the lifetime of a
compiled regular expression and text to search, respectively.</p>
<p>The only methods that allocate new strings are the string replacement
methods. All other methods (searching and splitting) return borrowed
pointers into the string given.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p>Find the location of a US phone number:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">&quot;[0-9]{3}-[0-9]{3}-[0-9]{4}&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">mat</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">find</span>(<span class="string">&quot;phone: 111-222-3333&quot;</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="ident">mat</span>.<span class="ident">start</span>(), <span class="ident">mat</span>.<span class="ident">end</span>()), (<span class="number">7</span>, <span class="number">19</span>));</pre></div>
<h1 id="using-the-stdstrpattern-methods-with-regex" class="section-header"><a href="#using-the-stdstrpattern-methods-with-regex">Using the <code>std::str::pattern</code> methods with <code>Regex</code></a></h1>
<blockquote>
<p><strong>Note</strong>: This section requires that this crate is compiled with the
<code>pattern</code> Cargo feature enabled, which <strong>requires nightly Rust</strong>.</p>
</blockquote>
<p>Since <code>Regex</code> implements <code>Pattern</code>, you can use regexes with methods
defined on <code>&amp;str</code>. For example, <code>is_match</code>, <code>find</code>, <code>find_iter</code>
and <code>split</code> can be replaced with <code>str::contains</code>, <code>str::find</code>,
<code>str::match_indices</code> and <code>str::split</code>.</p>
<p>Here are some examples:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;\d+&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">haystack</span> <span class="op">=</span> <span class="string">&quot;a111b222c&quot;</span>;
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">haystack</span>.<span class="ident">contains</span>(<span class="kw-2">&amp;</span><span class="ident">re</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">haystack</span>.<span class="ident">find</span>(<span class="kw-2">&amp;</span><span class="ident">re</span>), <span class="prelude-val">Some</span>(<span class="number">1</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">haystack</span>.<span class="ident">match_indices</span>(<span class="kw-2">&amp;</span><span class="ident">re</span>).<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;&gt;</span>(),
<span class="macro">vec</span><span class="macro">!</span>[(<span class="number">1</span>, <span class="number">4</span>), (<span class="number">5</span>, <span class="number">8</span>)]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">haystack</span>.<span class="ident">split</span>(<span class="kw-2">&amp;</span><span class="ident">re</span>).<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;&gt;</span>(), <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;a&quot;</span>, <span class="string">&quot;b&quot;</span>, <span class="string">&quot;c&quot;</span>]);</pre></div>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../src/regex/re_unicode.rs.html#170-592' title='goto source code'>[src]</a></h3><div class='docblock'><p>Core regular expression methods.</p>
</div><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>(re: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a>, <a class="enum" href="../regex/enum.Error.html" title="enum regex::Error">Error</a>&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#175-177' title='goto source code'>[src]</a></h4><div class='docblock'><p>Compiles a regular expression. Once compiled, it can be used repeatedly
to search, split or replace text in a string.</p>
<p>If an invalid expression is given, then an error is returned.</p>
</div><h4 id='method.is_match' class="method"><code id='is_match.v'>pub fn <a href='#method.is_match' class='fnname'>is_match</a>(&amp;self, text: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#197-199' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns true if and only if the regex matches the string given.</p>
<p>It is recommended to use this method if all you need to do is test
a match, since the underlying matching engine may be able to do less
work.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<p>Test if some text contains at least one word with exactly 13
Unicode word characters:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">text</span> <span class="op">=</span> <span class="string">&quot;I categorically deny having triskaidekaphobia.&quot;</span>;
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;\b\w{13}\b&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">is_match</span>(<span class="ident">text</span>));</pre></div>
</div><h4 id='method.find' class="method"><code id='find.v'>pub fn <a href='#method.find' class='fnname'>find</a>&lt;'t&gt;(&amp;self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../regex/struct.Match.html" title="struct regex::Match">Match</a>&lt;'t&gt;&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#222-224' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the start and end byte range of the leftmost-first match in
<code>text</code>. If no match exists, then <code>None</code> is returned.</p>
<p>Note that this should only be used if you want to discover the position
of the match. Testing the existence of a match is faster if you use
<code>is_match</code>.</p>
<h1 id="example-1" class="section-header"><a href="#example-1">Example</a></h1>
<p>Find the start and end location of the first word with exactly 13
Unicode word characters:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">text</span> <span class="op">=</span> <span class="string">&quot;I categorically deny having triskaidekaphobia.&quot;</span>;
<span class="kw">let</span> <span class="ident">mat</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;\b\w{13}\b&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">find</span>(<span class="ident">text</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">mat</span>.<span class="ident">start</span>(), <span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">mat</span>.<span class="ident">end</span>(), <span class="number">15</span>);</pre></div>
</div><h4 id='method.find_iter' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../regex/struct.Matches.html" title="struct regex::Matches">Matches</a>&lt;'r, 't&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../regex/struct.Matches.html" title="struct regex::Matches">Matches</a>&lt;'r, 't&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'r, 't&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../regex/struct.Matches.html" title="struct regex::Matches">Matches</a>&lt;'r, 't&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../regex/struct.Match.html" title="struct regex::Match">Match</a>&lt;'t&gt;;</span></code></div></div><code id='find_iter.v'>pub fn <a href='#method.find_iter' class='fnname'>find_iter</a>&lt;'r, 't&gt;(&amp;'r self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="../regex/struct.Matches.html" title="struct regex::Matches">Matches</a>&lt;'r, 't&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#244-246' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns an iterator for each successive non-overlapping match in
<code>text</code>, returning the start and end byte indices with respect to
<code>text</code>.</p>
<h1 id="example-2" class="section-header"><a href="#example-2">Example</a></h1>
<p>Find the start and end location of every word with exactly 13 Unicode
word characters:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">text</span> <span class="op">=</span> <span class="string">&quot;Retroactively relinquishing remunerations is reprehensible.&quot;</span>;
<span class="kw">for</span> <span class="ident">mat</span> <span class="kw">in</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;\b\w{13}\b&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">find_iter</span>(<span class="ident">text</span>) {
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">mat</span>);
}</pre></div>
</div><h4 id='method.captures' class="method"><code id='captures.v'>pub fn <a href='#method.captures' class='fnname'>captures</a>&lt;'t&gt;(&amp;self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../regex/struct.Captures.html" title="struct regex::Captures">Captures</a>&lt;'t&gt;&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#311-318' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the capture groups corresponding to the leftmost-first
match in <code>text</code>. Capture group <code>0</code> always corresponds to the entire
match. If no match is found, then <code>None</code> is returned.</p>
<p>You should only use <code>captures</code> if you need access to the location of
capturing group matches. Otherwise, <code>find</code> is faster for discovering
the location of the overall match.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<p>Say you have some text with movie names and their release years,
like &quot;'Citizen Kane' (1941)&quot;. It'd be nice if we could search for text
looking like that, while also extracting the movie name and its release
year separately.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;&#39;([^&#39;]+)&#39;\s+\((\d{4})\)&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">text</span> <span class="op">=</span> <span class="string">&quot;Not my favorite movie: &#39;Citizen Kane&#39; (1941).&quot;</span>;
<span class="kw">let</span> <span class="ident">caps</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">captures</span>(<span class="ident">text</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">caps</span>.<span class="ident">get</span>(<span class="number">1</span>).<span class="ident">unwrap</span>().<span class="ident">as_str</span>(), <span class="string">&quot;Citizen Kane&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">caps</span>.<span class="ident">get</span>(<span class="number">2</span>).<span class="ident">unwrap</span>().<span class="ident">as_str</span>(), <span class="string">&quot;1941&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">caps</span>.<span class="ident">get</span>(<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">as_str</span>(), <span class="string">&quot;&#39;Citizen Kane&#39; (1941)&quot;</span>);
<span class="comment">// You can also access the groups by index using the Index notation.</span>
<span class="comment">// Note that this will panic on an invalid index.</span>
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="number">1</span>], <span class="string">&quot;Citizen Kane&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="number">2</span>], <span class="string">&quot;1941&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="number">0</span>], <span class="string">&quot;&#39;Citizen Kane&#39; (1941)&quot;</span>);</pre></div>
<p>Note that the full match is at capture group <code>0</code>. Each subsequent
capture group is indexed by the order of its opening <code>(</code>.</p>
<p>We can make this example a bit clearer by using <em>named</em> capture groups:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;&#39;(?P&lt;title&gt;[^&#39;]+)&#39;\s+\((?P&lt;year&gt;\d{4})\)&quot;</span>)
.<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">text</span> <span class="op">=</span> <span class="string">&quot;Not my favorite movie: &#39;Citizen Kane&#39; (1941).&quot;</span>;
<span class="kw">let</span> <span class="ident">caps</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">captures</span>(<span class="ident">text</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">caps</span>.<span class="ident">name</span>(<span class="string">&quot;title&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">as_str</span>(), <span class="string">&quot;Citizen Kane&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">caps</span>.<span class="ident">name</span>(<span class="string">&quot;year&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">as_str</span>(), <span class="string">&quot;1941&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">caps</span>.<span class="ident">get</span>(<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">as_str</span>(), <span class="string">&quot;&#39;Citizen Kane&#39; (1941)&quot;</span>);
<span class="comment">// You can also access the groups by name using the Index notation.</span>
<span class="comment">// Note that this will panic on an invalid group name.</span>
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="string">&quot;title&quot;</span>], <span class="string">&quot;Citizen Kane&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="string">&quot;year&quot;</span>], <span class="string">&quot;1941&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="number">0</span>], <span class="string">&quot;&#39;Citizen Kane&#39; (1941)&quot;</span>);
</pre></div>
<p>Here we name the capture groups, which we can access with the <code>name</code>
method or the <code>Index</code> notation with a <code>&amp;str</code>. Note that the named
capture groups are still accessible with <code>get</code> or the <code>Index</code> notation
with a <code>usize</code>.</p>
<p>The <code>0</code>th capture group is always unnamed, so it must always be
accessed with <code>get(0)</code> or <code>[0]</code>.</p>
</div><h4 id='method.captures_iter' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../regex/struct.CaptureMatches.html" title="struct regex::CaptureMatches">CaptureMatches</a>&lt;'r, 't&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../regex/struct.CaptureMatches.html" title="struct regex::CaptureMatches">CaptureMatches</a>&lt;'r, 't&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'r, 't&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../regex/struct.CaptureMatches.html" title="struct regex::CaptureMatches">CaptureMatches</a>&lt;'r, 't&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../regex/struct.Captures.html" title="struct regex::Captures">Captures</a>&lt;'t&gt;;</span></code></div></div><code id='captures_iter.v'>pub fn <a href='#method.captures_iter' class='fnname'>captures_iter</a>&lt;'r, 't&gt;(&amp;'r self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="../regex/struct.CaptureMatches.html" title="struct regex::CaptureMatches">CaptureMatches</a>&lt;'r, 't&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#345-350' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns an iterator over all the non-overlapping capture groups matched
in <code>text</code>. This is operationally the same as <code>find_iter</code>, except it
yields information about capturing group matches.</p>
<h1 id="example-3" class="section-header"><a href="#example-3">Example</a></h1>
<p>We can use this to find all movie titles and their release years in
some text, where the movie is formatted like &quot;'Title' (xxxx)&quot;:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;&#39;(?P&lt;title&gt;[^&#39;]+)&#39;\s+\((?P&lt;year&gt;\d{4})\)&quot;</span>)
.<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">text</span> <span class="op">=</span> <span class="string">&quot;&#39;Citizen Kane&#39; (1941), &#39;The Wizard of Oz&#39; (1939), &#39;M&#39; (1931).&quot;</span>;
<span class="kw">for</span> <span class="ident">caps</span> <span class="kw">in</span> <span class="ident">re</span>.<span class="ident">captures_iter</span>(<span class="ident">text</span>) {
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;Movie: {:?}, Released: {:?}&quot;</span>,
<span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="string">&quot;title&quot;</span>], <span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="string">&quot;year&quot;</span>]);
}
<span class="comment">// Output:</span>
<span class="comment">// Movie: Citizen Kane, Released: 1941</span>
<span class="comment">// Movie: The Wizard of Oz, Released: 1939</span>
<span class="comment">// Movie: M, Released: 1931</span></pre></div>
</div><h4 id='method.split' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../regex/struct.Split.html" title="struct regex::Split">Split</a>&lt;'r, 't&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../regex/struct.Split.html" title="struct regex::Split">Split</a>&lt;'r, 't&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'r, 't&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../regex/struct.Split.html" title="struct regex::Split">Split</a>&lt;'r, 't&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>;</span></code></div></div><code id='split.v'>pub fn <a href='#method.split' class='fnname'>split</a>&lt;'r, 't&gt;(&amp;'r self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="../regex/struct.Split.html" title="struct regex::Split">Split</a>&lt;'r, 't&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#370-375' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns an iterator of substrings of <code>text</code> delimited by a match of the
regular expression. Namely, each element of the iterator corresponds to
text that <em>isn't</em> matched by the regular expression.</p>
<p>This method will <em>not</em> copy the text given.</p>
<h1 id="example-4" class="section-header"><a href="#example-4">Example</a></h1>
<p>To split a string delimited by arbitrary amounts of spaces or tabs:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;[ \t]+&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">fields</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">split</span>(<span class="string">&quot;a b \t c\td e&quot;</span>).<span class="ident">collect</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">fields</span>, <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;a&quot;</span>, <span class="string">&quot;b&quot;</span>, <span class="string">&quot;c&quot;</span>, <span class="string">&quot;d&quot;</span>, <span class="string">&quot;e&quot;</span>]);</pre></div>
</div><h4 id='method.splitn' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../regex/struct.SplitN.html" title="struct regex::SplitN">SplitN</a>&lt;'r, 't&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../regex/struct.SplitN.html" title="struct regex::SplitN">SplitN</a>&lt;'r, 't&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'r, 't&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../regex/struct.SplitN.html" title="struct regex::SplitN">SplitN</a>&lt;'r, 't&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>;</span></code></div></div><code id='splitn.v'>pub fn <a href='#method.splitn' class='fnname'>splitn</a>&lt;'r, 't&gt;(&amp;'r self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, limit: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="../regex/struct.SplitN.html" title="struct regex::SplitN">SplitN</a>&lt;'r, 't&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#397-403' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns an iterator of at most <code>limit</code> substrings of <code>text</code> delimited
by a match of the regular expression. (A <code>limit</code> of <code>0</code> will return no
substrings.) Namely, each element of the iterator corresponds to text
that <em>isn't</em> matched by the regular expression. The remainder of the
string that is not split will be the last element in the iterator.</p>
<p>This method will <em>not</em> copy the text given.</p>
<h1 id="example-5" class="section-header"><a href="#example-5">Example</a></h1>
<p>Get the first two words in some text:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;\W+&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">fields</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">splitn</span>(<span class="string">&quot;Hey! How are you?&quot;</span>, <span class="number">3</span>).<span class="ident">collect</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">fields</span>, <span class="macro">vec</span><span class="macro">!</span>(<span class="string">&quot;Hey&quot;</span>, <span class="string">&quot;How&quot;</span>, <span class="string">&quot;are you?&quot;</span>));</pre></div>
</div><h4 id='method.replace' class="method"><code id='replace.v'>pub fn <a href='#method.replace' class='fnname'>replace</a>&lt;'t, R:&nbsp;<a class="trait" href="../regex/trait.Replacer.html" title="trait regex::Replacer">Replacer</a>&gt;(&amp;self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, rep: R) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'t, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#509-515' title='goto source code'>[src]</a></h4><div class='docblock'><p>Replaces the leftmost-first match 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 the matches'
<code>Captures</code> and returns the replaced string.</p>
<p>If no match is found, then a copy of the string is returned unchanged.</p>
<h1 id="replacement-string-syntax" class="section-header"><a href="#replacement-string-syntax">Replacement string syntax</a></h1>
<p>All instances of <code>$name</code> in the replacement text is replaced with the
corresponding capture group <code>name</code>.</p>
<p><code>name</code> may be an integer corresponding to the index of the
capture group (counted by order of opening parenthesis where <code>0</code> is the
entire match) or it can be a name (consisting of letters, digits or
underscores) corresponding to a named capture group.</p>
<p>If <code>name</code> isn't a valid capture group (whether the name doesn't exist
or isn't a valid index), then it is replaced with the empty string.</p>
<p>The longest possible name is used. e.g., <code>$1a</code> looks up the capture
group named <code>1a</code> and not the capture group at index <code>1</code>. To exert more
precise control over the name, use braces, e.g., <code>${1}a</code>.</p>
<p>To write a literal <code>$</code> use <code>$$</code>.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<p>Note that this function is polymorphic with respect to the replacement.
In typical usage, this can just be a normal string:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">&quot;[^01]+&quot;</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">re</span>.<span class="ident">replace</span>(<span class="string">&quot;1078910&quot;</span>, <span class="string">&quot;&quot;</span>), <span class="string">&quot;1010&quot;</span>);</pre></div>
<p>But anything satisfying the <code>Replacer</code> trait will work. For example,
a closure of type <code>|&amp;Captures| -&gt; String</code> provides direct access to the
captures corresponding to a match. This allows one to access
capturing group matches easily:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;([^,\s]+),\s+(\S+)&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">replace</span>(<span class="string">&quot;Springsteen, Bruce&quot;</span>, <span class="op">|</span><span class="ident">caps</span>: <span class="kw-2">&amp;</span><span class="ident">Captures</span><span class="op">|</span> {
<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;{} {}&quot;</span>, <span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="number">2</span>], <span class="kw-2">&amp;</span><span class="ident">caps</span>[<span class="number">1</span>])
});
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">result</span>, <span class="string">&quot;Bruce Springsteen&quot;</span>);</pre></div>
<p>But this is a bit cumbersome to use all the time. Instead, a simple
syntax is supported that expands <code>$name</code> into the corresponding capture
group. Here's the last example, but using this expansion technique
with named capture groups:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;(?P&lt;last&gt;[^,\s]+),\s+(?P&lt;first&gt;\S+)&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">replace</span>(<span class="string">&quot;Springsteen, Bruce&quot;</span>, <span class="string">&quot;$first $last&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">result</span>, <span class="string">&quot;Bruce Springsteen&quot;</span>);</pre></div>
<p>Note that using <code>$2</code> instead of <code>$first</code> or <code>$1</code> instead of <code>$last</code>
would produce the same result. To write a literal <code>$</code> use <code>$$</code>.</p>
<p>Sometimes the replacement string requires use of curly braces to
delineate a capture group replacement and surrounding literal text.
For example, if we wanted to join two words together with an
underscore:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;(?P&lt;first&gt;\w+)\s+(?P&lt;second&gt;\w+)&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">replace</span>(<span class="string">&quot;deep fried&quot;</span>, <span class="string">&quot;${first}_$second&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">result</span>, <span class="string">&quot;deep_fried&quot;</span>);</pre></div>
<p>Without the curly braces, the capture group name <code>first_</code> would be
used, and since it doesn't exist, it would be replaced with the empty
string.</p>
<p>Finally, sometimes you just want to replace a literal string with no
regard for capturing group expansion. This can be done by wrapping a
byte string with <code>NoExpand</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">regex</span>::<span class="ident">NoExpand</span>;
<span class="kw">let</span> <span class="ident">re</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;(?P&lt;last&gt;[^,\s]+),\s+(\S+)&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">re</span>.<span class="ident">replace</span>(<span class="string">&quot;Springsteen, Bruce&quot;</span>, <span class="ident">NoExpand</span>(<span class="string">&quot;$2 $last&quot;</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">result</span>, <span class="string">&quot;$2 $last&quot;</span>);</pre></div>
</div><h4 id='method.replace_all' class="method"><code id='replace_all.v'>pub fn <a href='#method.replace_all' class='fnname'>replace_all</a>&lt;'t, R:&nbsp;<a class="trait" href="../regex/trait.Replacer.html" title="trait regex::Replacer">Replacer</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;rep: R<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'t, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#523-529' title='goto source code'>[src]</a></h4><div class='docblock'><p>Replaces all non-overlapping matches in <code>text</code> with the replacement
provided. This is the same as calling <code>replacen</code> with <code>limit</code> set to
<code>0</code>.</p>
<p>See the documentation for <code>replace</code> for details on how to access
capturing group matches in the replacement string.</p>
</div><h4 id='method.replacen' class="method"><code id='replacen.v'>pub fn <a href='#method.replacen' class='fnname'>replacen</a>&lt;'t, R:&nbsp;<a class="trait" href="../regex/trait.Replacer.html" title="trait regex::Replacer">Replacer</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;limit: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;rep: R<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'t, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#537-591' title='goto source code'>[src]</a></h4><div class='docblock'><p>Replaces at most <code>limit</code> non-overlapping matches in <code>text</code> with the
replacement provided. If <code>limit</code> is 0, then all non-overlapping matches
are replaced.</p>
<p>See the documentation for <code>replace</code> for details on how to access
capturing group matches in the replacement string.</p>
</div></div><h3 id='impl-1' class='impl'><code class='in-band'>impl <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-1' class='anchor'></a><a class='srclink' href='../src/regex/re_unicode.rs.html#595-711' title='goto source code'>[src]</a></h3><div class='docblock'><p>Advanced or &quot;lower level&quot; search methods.</p>
</div><div class='impl-items'><h4 id='method.shortest_match' class="method"><code id='shortest_match.v'>pub fn <a href='#method.shortest_match' class='fnname'>shortest_match</a>(&amp;self, text: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#617-619' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the end location of a match in the text given.</p>
<p>This method may have the same performance characteristics as
<code>is_match</code>, except it provides an end location for a match. In
particular, the location returned <em>may be shorter</em> than the proper end
of the leftmost-first match.</p>
<h1 id="example-6" class="section-header"><a href="#example-6">Example</a></h1>
<p>Typically, <code>a+</code> would match the entire first sequence of <code>a</code> in some
text, but <code>shortest_match</code> can give up as soon as it sees the first
<code>a</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">text</span> <span class="op">=</span> <span class="string">&quot;aaaaa&quot;</span>;
<span class="kw">let</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">Regex</span>::<span class="ident">new</span>(<span class="string">r&quot;a+&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">shortest_match</span>(<span class="ident">text</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">pos</span>, <span class="prelude-val">Some</span>(<span class="number">1</span>));</pre></div>
</div><h4 id='method.shortest_match_at' class="method"><code id='shortest_match_at.v'>pub fn <a href='#method.shortest_match_at' class='fnname'>shortest_match_at</a>(&amp;self, text: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, start: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#627-633' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the same as shortest_match, 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>
</div><h4 id='method.is_match_at' class="method"><code id='is_match_at.v'>pub fn <a href='#method.is_match_at' class='fnname'>is_match_at</a>(&amp;self, text: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, start: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#641-643' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the same as is_match, 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>
</div><h4 id='method.find_at' class="method"><code id='find_at.v'>pub fn <a href='#method.find_at' class='fnname'>find_at</a>&lt;'t&gt;(&amp;self, text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, start: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../regex/struct.Match.html" title="struct regex::Match">Match</a>&lt;'t&gt;&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#651-659' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the same as find, 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>
</div><h4 id='method.captures_read' class="method"><code id='captures_read.v'>pub fn <a href='#method.captures_read' class='fnname'>captures_read</a>&lt;'t&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;locs: &amp;mut <a class="struct" href="../regex/struct.CaptureLocations.html" title="struct regex::CaptureLocations">CaptureLocations</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../regex/struct.Match.html" title="struct regex::Match">Match</a>&lt;'t&gt;&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#671-677' title='goto source code'>[src]</a></h4><div class='docblock'><p>This is like <code>captures</code>, but uses
<a href="struct.CaptureLocations.html"><code>CaptureLocations</code></a>
instead of
<a href="struct.Captures.html"><code>Captures</code></a> in order to amortize allocations.</p>
<p>To create a <code>CaptureLocations</code> value, use the
<code>Regex::capture_locations</code> method.</p>
<p>This returns the overall match if this was successful, which is always
equivalence to the <code>0</code>th capture group.</p>
</div><h4 id='method.captures_read_at' class="method"><code id='captures_read_at.v'>pub fn <a href='#method.captures_read_at' class='fnname'>captures_read_at</a>&lt;'t&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;locs: &amp;mut <a class="struct" href="../regex/struct.CaptureLocations.html" title="struct regex::CaptureLocations">CaptureLocations</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;text: &amp;'t <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;start: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../regex/struct.Match.html" title="struct regex::Match">Match</a>&lt;'t&gt;&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#685-695' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the same as captures, but starts the search at the given
offset and populates the capture locations given.</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>
</div></div><h3 id='impl-2' class='impl'><code class='in-band'>impl <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-2' class='anchor'></a><a class='srclink' href='../src/regex/re_unicode.rs.html#714-744' title='goto source code'>[src]</a></h3><div class='docblock'><p>Auxiliary methods.</p>
</div><div class='impl-items'><h4 id='method.as_str' class="method"><code id='as_str.v'>pub fn <a href='#method.as_str' class='fnname'>as_str</a>(&amp;self) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#716-718' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the original string of this regex.</p>
</div><h4 id='method.capture_names' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../regex/struct.CaptureNames.html" title="struct regex::CaptureNames">CaptureNames</a>&lt;'r&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../regex/struct.CaptureNames.html" title="struct regex::CaptureNames">CaptureNames</a>&lt;'r&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'r&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../regex/struct.CaptureNames.html" title="struct regex::CaptureNames">CaptureNames</a>&lt;'r&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;'r <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;;</span></code></div></div><code id='capture_names.v'>pub fn <a href='#method.capture_names' class='fnname'>capture_names</a>(&amp;self) -&gt; <a class="struct" href="../regex/struct.CaptureNames.html" title="struct regex::CaptureNames">CaptureNames</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#721-723' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns an iterator over the capture names.</p>
</div><h4 id='method.captures_len' class="method"><code id='captures_len.v'>pub fn <a href='#method.captures_len' class='fnname'>captures_len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#726-728' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the number of captures.</p>
</div><h4 id='method.capture_locations' class="method"><code id='capture_locations.v'>pub fn <a href='#method.capture_locations' class='fnname'>capture_locations</a>(&amp;self) -&gt; <a class="struct" href="../regex/struct.CaptureLocations.html" title="struct regex::CaptureLocations">CaptureLocations</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#732-734' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns an empty set of capture locations that can be reused in
multiple calls to <code>captures_read</code> or <code>captures_read_at</code>.</p>
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../src/regex/re_unicode.rs.html#136' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#136' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a></h4><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Display' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-Display' class='anchor'></a><a class='srclink' href='../src/regex/re_unicode.rs.html#139-144' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#141-143' title='goto source code'>[src]</a></h4><div class='docblock'><p>Shows the original regular expression.</p>
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../src/regex/re_unicode.rs.html#146-151' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt-1' class="method"><code id='fmt.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../src/regex/re_unicode.rs.html#148-150' title='goto source code'>[src]</a></h4><div class='docblock'><p>Shows the original regular expression.</p>
</div></div><h3 id='impl-FromStr' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html" title="trait core::str::FromStr">FromStr</a> for <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-FromStr' class='anchor'></a><a class='srclink' href='../src/regex/re_unicode.rs.html#160-167' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Err' class="type"><code id='Err.t'>type <a href='https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#associatedtype.Err' class="type">Err</a> = <a class="enum" href="../regex/enum.Error.html" title="enum regex::Error">Error</a></code></h4><div class='docblock'><p>The associated error which can be returned from parsing.</p>
</div><h4 id='method.from_str' class="method"><code id='from_str.v'>fn <a href='https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#tymethod.from_str' class='fnname'>from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a>, <a class="enum" href="../regex/enum.Error.html" title="enum regex::Error">Error</a>&gt;</code><a class='srclink' href='../src/regex/re_unicode.rs.html#164-166' title='goto source code'>[src]</a></h4><div class='docblock'><p>Attempts to parse a string into a regular expression</p>
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-Send' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../regex/struct.Regex.html" title="struct regex::Regex">Regex</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#546-548' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#547' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-ToOwned' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-ToOwned' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-92' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Owned' class="type"><code id='Owned.t'>type <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned' class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
</div><h4 id='method.to_owned' class="method hidden"><code id='to_owned.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned' class='fnname'>to_owned</a>(&amp;self) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85-87' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div><h4 id='method.clone_into' class="method hidden"><code id='clone_into.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into' class='fnname'>clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89-91' title='goto source code'>[src]</a></h4><div class='stability hidden'><div class='stab unstable'><details><summary><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
</div></div><h3 id='impl-ToString' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-ToString' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2132-2142' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.to_string' class="method hidden"><code id='to_string.v'>default fn <a href='https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string' class='fnname'>to_string</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2134-2141' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#537-542' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#539-541' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#565-571' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#568-570' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#553-560' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#557-559' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-220' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-215' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#100-102' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#101' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "regex";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>