use rfc 5322 email regex
This commit is contained in:
@@ -86,8 +86,9 @@ pub enum UserEmailError {
|
|||||||
Empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
static USER_EMAIL_REGEX: LazyLock<Regex> =
|
static USER_EMAIL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
|
||||||
LazyLock::new(|| Regex::new(r"^[^@]+@[^@]+\.[^@]+$").expect("Email regex"));
|
Regex::new(r#"^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$"#).expect("Email regex")
|
||||||
|
});
|
||||||
|
|
||||||
impl UserEmail {
|
impl UserEmail {
|
||||||
pub fn new(raw: &str) -> Result<Self, UserEmailError> {
|
pub fn new(raw: &str) -> Result<Self, UserEmailError> {
|
||||||
|
|||||||
Reference in New Issue
Block a user