Trait string_patterns::words::MatchWord
source · pub trait MatchWordwhere
Self: PatternMatch + PatternCapture,{
Show 21 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 { ... }
fn match_words_by_proximity(
&self,
first: &str,
second: &str,
min: i16,
max: i16,
case_insensitive: bool
) -> 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?”)];
sourcefn match_words_by_proximity(
&self,
first: &str,
second: &str,
min: i16,
max: i16,
case_insensitive: bool
) -> bool
fn match_words_by_proximity( &self, first: &str, second: &str, min: i16, max: i16, case_insensitive: bool ) -> bool
Check if whole word patterns occur in close proximity as defined by their min and max values If the second word may occur before the first the min value should negative The distance between the end of the first and start of the second word is measured
Implementations on Foreign Types§
impl MatchWord for str
Automatic implementation for str/String as both implement PatternMatch and PatternCapture in this crate