pub trait PatternMatch {
// Required method
fn pattern_match_result(
&self,
pattern: &str,
case_insensitive: bool,
) -> Result<bool, Error>;
// Provided methods
fn pattern_match(&self, pattern: &str, case_insensitive: bool) -> bool { ... }
fn pattern_match_ci(&self, pattern: &str) -> bool { ... }
fn pattern_match_cs(&self, pattern: &str) -> bool { ... }
}
Expand description
Core regular expression match methods
Required Methods§
Provided Methods§
Sourcefn pattern_match(&self, pattern: &str, case_insensitive: bool) -> bool
fn pattern_match(&self, pattern: &str, case_insensitive: bool) -> bool
Apply a regular expression match on the current string with a boolean case_insensitive flag NB: If the regex doesn’t compile it will return false
Sourcefn pattern_match_ci(&self, pattern: &str) -> bool
fn pattern_match_ci(&self, pattern: &str) -> bool
if the pattern does not match the source string or the regex fails
Sourcefn pattern_match_cs(&self, pattern: &str) -> bool
fn pattern_match_cs(&self, pattern: &str) -> bool
Simple case-sensitive regex-compatible match method that will return false if the pattern does not match the source string or the regex fails
Implementations on Foreign Types§
Source§impl PatternMatch for str
Implement regular expression match and replace methods for str and owned String
impl PatternMatch for str
Implement regular expression match and replace methods for str and owned String
Source§fn pattern_match_result(
&self,
pattern: &str,
case_insensitive: bool,
) -> Result<bool, Error>
fn pattern_match_result( &self, pattern: &str, case_insensitive: bool, ) -> Result<bool, Error>
Simple regex-compatible match method that will return an optional boolean
- Some(true) means the regex is valid and the string matches
- Some(false) means the regex is valid and the string does not match
- None means the regex is not valid and can this not be evaluated Only the pattern_match_result needs to be implemented
Source§impl PatternMatch for [&str]
Boolean methods to match a pattern within an array of strings
impl PatternMatch for [&str]
Boolean methods to match a pattern within an array of strings
Source§impl PatternMatch for [String]
Boolean methods to match a pattern within an array of strings
impl PatternMatch for [String]
Boolean methods to match a pattern within an array of strings