Trait string_patterns::words::MatchWord
source · pub trait MatchWord<'a>where
Self: PatternMatch + PatternCapture<'a>,{
Show 20 methods
// Provided methods
fn match_word_bounds(
&self,
word: &str,
bounds: WordBounds,
case_insensitive: bool
) -> bool { ... }
fn match_word(&self, word: &str, case_insensitive: bool) -> bool { ... }
fn match_any_words(&self, words: &[&str], case_insensitive: bool) -> bool { ... }
fn match_word_start(&self, word: &str, case_insensitive: bool) -> bool { ... }
fn match_word_end(&self, word: &str, case_insensitive: bool) -> bool { ... }
fn match_word_ci(&self, word: &str) -> bool { ... }
fn match_any_words_ci(&self, words: &[&str]) -> bool { ... }
fn match_any_words_cs(&self, words: &[&str]) -> bool { ... }
fn match_word_start_ci(&self, word: &str) -> bool { ... }
fn match_word_end_ci(&self, word: &str) -> bool { ... }
fn match_word_cs(&self, word: &str) -> bool { ... }
fn match_word_start_cs(&self, word: &str) -> bool { ... }
fn match_words_ci(&self, words: &[&str]) -> bool { ... }
fn match_words_cs(&self, words: &[&str]) -> bool { ... }
fn match_word_end_cs(&self, word: &str) -> bool { ... }
fn count_matched_words_bounds(
&self,
words: &[&str],
bounds: WordBounds,
case_insensitive: bool
) -> usize { ... }
fn match_words_bounds(
&self,
words: &[&str],
bounds: WordBounds,
case_insensitive: bool
) -> bool { ... }
fn match_words(&self, words: &[&str], case_insensitive: bool) -> bool { ... }
fn match_words_sets_conditional(&self, sets: &[(bool, &str, bool)]) -> bool { ... }
fn match_words_sets_conditional_ci(&self, tuples: &[(bool, &str)]) -> bool { ... }
}
Expand description
Provides methods to match words with differnt word boundary and case-semsitivity rules
Provided Methods§
sourcefn match_word_bounds(
&self,
word: &str,
bounds: WordBounds,
case_insensitive: bool
) -> bool
fn match_word_bounds( &self, word: &str, bounds: WordBounds, case_insensitive: bool ) -> bool
Match a word with bounds options and case_insensitive flag
sourcefn match_word(&self, word: &str, case_insensitive: bool) -> bool
fn match_word(&self, word: &str, case_insensitive: bool) -> bool
Case-conditional match of a whole word To match only the start or end, use the start and end methods or expand the pattern with \w* at either end
sourcefn match_any_words(&self, words: &[&str], case_insensitive: bool) -> bool
fn match_any_words(&self, words: &[&str], case_insensitive: bool) -> bool
Match any whole words only with a boolean case_insensitive flag
sourcefn match_word_start(&self, word: &str, case_insensitive: bool) -> bool
fn match_word_start(&self, word: &str, case_insensitive: bool) -> bool
Case-conditional match from the start of a word boundary
sourcefn match_word_end(&self, word: &str, case_insensitive: bool) -> bool
fn match_word_end(&self, word: &str, case_insensitive: bool) -> bool
Case-conditional match to the end of a word boundary
sourcefn match_word_ci(&self, word: &str) -> bool
fn match_word_ci(&self, word: &str) -> bool
Case-insensitive whole word match, for words with optional hyphens use -?, e.g. hip-?hop matches hip-hop and hiphop, but not hip-hopping To match only the start or end, use the start and end methods or expand the pattern with \w* at either end
sourcefn match_any_words_ci(&self, words: &[&str]) -> bool
fn match_any_words_ci(&self, words: &[&str]) -> bool
Match any whole words only in case-insensitive mode
sourcefn match_any_words_cs(&self, words: &[&str]) -> bool
fn match_any_words_cs(&self, words: &[&str]) -> bool
Match any whole words only in case-sensitive mode
sourcefn match_word_start_ci(&self, word: &str) -> bool
fn match_word_start_ci(&self, word: &str) -> bool
Case-insensitive match from the start of a word boundary
sourcefn match_word_end_ci(&self, word: &str) -> bool
fn match_word_end_ci(&self, word: &str) -> bool
Case-insensitive match to the end of a word boundary
sourcefn match_word_cs(&self, word: &str) -> bool
fn match_word_cs(&self, word: &str) -> bool
Case-sensitive whole word match, for words with optional hyphens use -?, e.g. hip-?hop matches hip-hop and hiphop, but not hip-hopping To match only the start or end, use the start and end methods or expand the pattern with \w* at either end
sourcefn match_word_start_cs(&self, word: &str) -> bool
fn match_word_start_cs(&self, word: &str) -> bool
Case-sensitive match from the start of a word boundary
sourcefn match_words_ci(&self, words: &[&str]) -> bool
fn match_words_ci(&self, words: &[&str]) -> bool
Match all whole words in case-insensitive mode
sourcefn match_words_cs(&self, words: &[&str]) -> bool
fn match_words_cs(&self, words: &[&str]) -> bool
Match all whole words in case-sensitive mode
sourcefn match_word_end_cs(&self, word: &str) -> bool
fn match_word_end_cs(&self, word: &str) -> bool
Case-sensitive match to the end of a word boundary
sourcefn count_matched_words_bounds(
&self,
words: &[&str],
bounds: WordBounds,
case_insensitive: bool
) -> usize
fn count_matched_words_bounds( &self, words: &[&str], bounds: WordBounds, case_insensitive: bool ) -> usize
Count matched words from an array of strs with boundary and case_insensitive options
sourcefn match_words_bounds(
&self,
words: &[&str],
bounds: WordBounds,
case_insensitive: bool
) -> bool
fn match_words_bounds( &self, words: &[&str], bounds: WordBounds, case_insensitive: bool ) -> bool
Match all words in array with boundary and case_insensitive options
sourcefn match_words(&self, words: &[&str], case_insensitive: bool) -> bool
fn match_words(&self, words: &[&str], case_insensitive: bool) -> bool
Match all whole words only with a boolean case_insensitive flag
sourcefn match_words_sets_conditional(&self, sets: &[(bool, &str, bool)]) -> bool
fn match_words_sets_conditional(&self, sets: &[(bool, &str, bool)]) -> bool
Match sets of words with positivity, pattern and case_insensitive parameters in tuples e.g. to match sentences with cat(s) but not dog(s) (lower case only) let sets = [(true, “cats?”, true), (false, “dogs?”, false)];
sourcefn match_words_sets_conditional_ci(&self, tuples: &[(bool, &str)]) -> bool
fn match_words_sets_conditional_ci(&self, tuples: &[(bool, &str)]) -> bool
Match sets of words with positivity and pattern tuple in case-insensitive mode e.g. to match sentences with cat(s) but not dog(s) (lower case only) let sets = [(true, “cats?”), (false, “dogs?”)];
Implementations on Foreign Types§
impl<'a> MatchWord<'a> for str
Automatic implementation for str/String as both implement PatternMatch and PatternCapture in this crate