pub struct Match { /* private fields */ }
Expand description
The match location of a Regex against a given input.
The sub-match indices are relative to the input used to run the original match.
Implementations§
Source§impl Match
impl Match
Sourcepub fn str_match_text(&self, s: &str) -> String
pub fn str_match_text(&self, s: &str) -> String
Extract this match from the given string
Sourcepub fn str_loc_bytes(&self, s: &str) -> (usize, usize)
pub fn str_loc_bytes(&self, s: &str) -> (usize, usize)
The start and end of this match in terms of byte offsets
use loc for character offsets
Sourcepub fn str_sub_loc_bytes(&self, n: usize, s: &str) -> Option<(usize, usize)>
pub fn str_sub_loc_bytes(&self, n: usize, s: &str) -> Option<(usize, usize)>
The start and end of the nth submatch in terms of byte offsets
Sourcepub fn named_matches(&self) -> Vec<&str>
pub fn named_matches(&self) -> Vec<&str>
The names of each submatch
Sourcepub fn str_sub_loc_bytes_by_name(
&self,
name: &str,
s: &str,
) -> Option<(usize, usize)>
pub fn str_sub_loc_bytes_by_name( &self, name: &str, s: &str, ) -> Option<(usize, usize)>
The start and end of a named submatch in terms of byte offsets
Sourcepub fn str_sub_loc_text_ref_by_name<'a>(
&self,
name: &str,
s: &'a str,
) -> Option<&'a str>
pub fn str_sub_loc_text_ref_by_name<'a>( &self, name: &str, s: &'a str, ) -> Option<&'a str>
The contents of a named submatch
Sourcepub fn str_match_text_ref<'a>(&self, s: &'a str) -> &'a str
pub fn str_match_text_ref<'a>(&self, s: &'a str) -> &'a str
The full match as applied to s
Trait Implementations§
impl Eq for Match
impl StructuralPartialEq for Match
Auto Trait Implementations§
impl Freeze for Match
impl RefUnwindSafe for Match
impl !Send for Match
impl !Sync for Match
impl Unpin for Match
impl UnwindSafe for Match
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.