pub trait PatternCapture<'a> {
Show 13 methods
// Required methods
fn pattern_captures(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<Captures<'a>>;
fn pattern_matches_as_vec(
&'a self,
pattern: &str,
case_insensitive: bool,
outer: bool,
) -> Vec<Match<'a>>;
fn pattern_first_match(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<Match<'a>>;
// Provided methods
fn pattern_matches_vec(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Vec<Match<'a>> { ... }
fn pattern_matches_outer(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Vec<Match<'a>> { ... }
fn pattern_last_match(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<Match<'a>> { ... }
fn pattern_first_last_matches(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<(Match<'a>, Match<'a>)> { ... }
fn pattern_first_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize> { ... }
fn pattern_first_end_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize> { ... }
fn pattern_last_start_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize> { ... }
fn pattern_last_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize> { ... }
fn count_pattern(
&'a self,
pattern: &'a str,
case_insensitive: bool,
) -> usize { ... }
fn count_word(&'a self, word: &'a str, case_insensitive: bool) -> usize { ... }
}Expand description
Set of methods to capture groups or match objects derived from Regex::captures.
Required Methods§
Sourcefn pattern_captures(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<Captures<'a>>
fn pattern_captures( &'a self, pattern: &str, case_insensitive: bool, ) -> Option<Captures<'a>>
Yields an option with Regex::Captures as returned from re.captures, Accepts a boolean case_insensitive flag
Provided Methods§
Sourcefn pattern_matches_vec(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Vec<Match<'a>>
fn pattern_matches_vec( &'a self, pattern: &str, case_insensitive: bool, ) -> Vec<Match<'a>>
Yields a vector of Match objects with start and end index + the captured string. Accepts a boolean case_insensitive flag Unlike pattern_captures, this method will only return unique matches including subgroups
Sourcefn pattern_matches_outer(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Vec<Match<'a>>
fn pattern_matches_outer( &'a self, pattern: &str, case_insensitive: bool, ) -> Vec<Match<'a>>
Yields a vector of Match objects with start and end index + the captured string. Accepts a boolean case_insensitive flag Unlike pattern_captures, this method will only outer matches for whole pattern
Sourcefn pattern_last_match(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<Match<'a>>
fn pattern_last_match( &'a self, pattern: &str, case_insensitive: bool, ) -> Option<Match<'a>>
Yields an option with last match object if available with a boolean case_insensitive flag
Sourcefn pattern_first_last_matches(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<(Match<'a>, Match<'a>)>
fn pattern_first_last_matches( &'a self, pattern: &str, case_insensitive: bool, ) -> Option<(Match<'a>, Match<'a>)>
returns an option with a pair of match objects If there is only one match the match objects will have the same indices
Sourcefn pattern_first_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize>
fn pattern_first_index( &'a self, pattern: &str, case_insensitive: bool, ) -> Option<usize>
Yields an option with an unsigned integer for the index of the start of the last match with a boolean case_insensitive flag
Sourcefn pattern_first_end_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize>
fn pattern_first_end_index( &'a self, pattern: &str, case_insensitive: bool, ) -> Option<usize>
Yields an option with an unsigned integer for the index of the end of the first match with a boolean case_insensitive flag
Sourcefn pattern_last_start_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize>
fn pattern_last_start_index( &'a self, pattern: &str, case_insensitive: bool, ) -> Option<usize>
Yields an option with an unsigned integer for the index of the start of the last match with a boolean case_insensitive flag
Sourcefn pattern_last_index(
&'a self,
pattern: &str,
case_insensitive: bool,
) -> Option<usize>
fn pattern_last_index( &'a self, pattern: &str, case_insensitive: bool, ) -> Option<usize>
with a boolean case_insensitive flag
fn count_pattern(&'a self, pattern: &'a str, case_insensitive: bool) -> usize
fn count_word(&'a self, word: &'a str, case_insensitive: bool) -> usize
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<'a, T: AsRef<str>> PatternCapture<'a> for T
Implementation for any string-like type (&str, String, &String, Cow<str>, etc.)