pub trait PatternCapture {
// Required methods
fn pattern_captures(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Captures<'_>>;
fn pattern_matches_vec(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<Match<'_>>;
fn pattern_first_match(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Match<'_>>;
fn pattern_last_match(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Match<'_>>;
fn pattern_first_last_matches(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<(Match<'_>, Match<'_>)>;
fn pattern_first_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>;
fn pattern_first_end_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>;
fn pattern_last_start_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>;
fn pattern_last_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>;
fn count_pattern(&self, pattern: &str, case_insensitive: bool) -> usize;
fn count_word(&self, word: &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(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Captures<'_>>
fn pattern_captures( &self, pattern: &str, case_insensitive: bool ) -> Option<Captures<'_>>
Yields an option with Regex::Captures as returned from re.captures, Accepts a boolean case_insensitive flag
sourcefn pattern_matches_vec(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<Match<'_>>
fn pattern_matches_vec( &self, pattern: &str, case_insensitive: bool ) -> Vec<Match<'_>>
Yields a vector of Match objects with start and end index + the captured string. Accepts a boolean case_insensitive flag
sourcefn pattern_first_match(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Match<'_>>
fn pattern_first_match( &self, pattern: &str, case_insensitive: bool ) -> Option<Match<'_>>
Yields an option with first match object if available with a boolean case_insensitive flag
sourcefn pattern_last_match(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Match<'_>>
fn pattern_last_match( &self, pattern: &str, case_insensitive: bool ) -> Option<Match<'_>>
Yields an option with last match object if available with a boolean case_insensitive flag
sourcefn pattern_first_last_matches(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<(Match<'_>, Match<'_>)>
fn pattern_first_last_matches( &self, pattern: &str, case_insensitive: bool ) -> Option<(Match<'_>, Match<'_>)>
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(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_first_index( &self, pattern: &str, case_insensitive: bool ) -> Option<usize>
Yields an option with an unsigned integer for the index of the start of the first match with a boolean case_insensitive flag
sourcefn pattern_first_end_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_first_end_index( &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(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_last_start_index( &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(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_last_index( &self, pattern: &str, case_insensitive: bool ) -> Option<usize>
Yields an option with an unsigned integer for the index of the end of the last match with a boolean case_insensitive flag
fn count_pattern(&self, pattern: &str, case_insensitive: bool) -> usize
fn count_word(&self, word: &str, case_insensitive: bool) -> usize
Implementations on Foreign Types§
source§impl PatternCapture for str
impl PatternCapture for str
source§fn pattern_matches_vec(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<Match<'_>>
fn pattern_matches_vec( &self, pattern: &str, case_insensitive: bool ) -> Vec<Match<'_>>
Yields a vector of Match objects with start and end index + the captured string. Accepts a boolean case_insensitive flag
source§fn pattern_first_match(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Match<'_>>
fn pattern_first_match( &self, pattern: &str, case_insensitive: bool ) -> Option<Match<'_>>
Yields an option with first match object if available with a boolean case_insensitive flag As this uses re.find it will be fast than the matching last_match method
source§fn pattern_last_match(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<Match<'_>>
fn pattern_last_match( &self, pattern: &str, case_insensitive: bool ) -> Option<Match<'_>>
Yields an option with last match object if available with a boolean case_insensitive flag
source§fn pattern_first_last_matches(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<(Match<'_>, Match<'_>)>
fn pattern_first_last_matches( &self, pattern: &str, case_insensitive: bool ) -> Option<(Match<'_>, Match<'_>)>
returns an option with a pair of match objects If there is only one match the match objects will have the same indices
source§fn pattern_first_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_first_index( &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
source§fn pattern_first_end_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_first_end_index( &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
source§fn pattern_last_start_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_last_start_index( &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
source§fn pattern_last_index(
&self,
pattern: &str,
case_insensitive: bool
) -> Option<usize>
fn pattern_last_index( &self, pattern: &str, case_insensitive: bool ) -> Option<usize>
with a boolean case_insensitive flag