pub struct PatternValidator {
    pub message: Option<String>,
    pub full_match: bool,
    pub case_sensitive: bool,
    /* private fields */
}Expand description
Validator for custom regular expression patterns
Fields§
§message: Option<String>Custom error message
full_match: boolWhether to match the entire string (default) or just find a match
case_sensitive: boolCase-sensitive matching (default: true)
Implementations§
Source§impl PatternValidator
 
impl PatternValidator
Sourcepub fn new_case_insensitive(pattern: &str) -> Result<Self, Error>
 
pub fn new_case_insensitive(pattern: &str) -> Result<Self, Error>
Create a case-insensitive pattern validator
Sourcepub fn from_regex(regex: Regex) -> Self
 
pub fn from_regex(regex: Regex) -> Self
Create a validator from an existing Regex
Sourcepub fn full_match(self, full_match: bool) -> Self
 
pub fn full_match(self, full_match: bool) -> Self
Set whether to match the full string or just find a match
Sourcepub fn pattern_string(&self) -> &str
 
pub fn pattern_string(&self) -> &str
Get the pattern string
Source§impl PatternValidator
Common pattern validators for typical use cases
 
impl PatternValidator
Common pattern validators for typical use cases
Sourcepub fn alphanumeric() -> Self
 
pub fn alphanumeric() -> Self
Create a validator for alphanumeric strings only
Sourcepub fn alphabetic() -> Self
 
pub fn alphabetic() -> Self
Create a validator for alphabetic characters only
Sourcepub fn numeric_string() -> Self
 
pub fn numeric_string() -> Self
Create a validator for numeric strings only
Sourcepub fn strong_password() -> Self
 
pub fn strong_password() -> Self
Create a validator for strong passwords (simplified - checks length only) Note: For complete password strength validation, use multiple validators
Sourcepub fn mac_address() -> Self
 
pub fn mac_address() -> Self
Create a validator for MAC addresses
Sourcepub fn credit_card() -> Self
 
pub fn credit_card() -> Self
Create a validator for credit card numbers (basic Luhn algorithm check)
Sourcepub fn zip_code_us() -> Self
 
pub fn zip_code_us() -> Self
Create a validator for postal codes (US ZIP codes)
Trait Implementations§
Source§impl Clone for PatternValidator
 
impl Clone for PatternValidator
Source§fn clone(&self) -> PatternValidator
 
fn clone(&self) -> PatternValidator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read more