Skip to content
Permalink
Browse files

fix(api): use correct apostrophe character in email address regex

  • Loading branch information...
philbooth committed Feb 11, 2019
1 parent 8527be4 commit b16f52e97da5fd1665654abc0a952f9502853c2a
Showing with 3 additions and 1 deletion.
  1. +1 −1 src/types/validate/mod.rs
  2. +2 −0 src/types/validate/test.rs
@@ -26,7 +26,7 @@ lazy_static! {
r"^https?://[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*(?::[0-9]+)?/(?:[A-Za-z0-9-]+/)*$"
).unwrap();
static ref EMAIL_ADDRESS_FORMAT: Regex = Regex::new(
r"^[a-zA-Z0-9.\pL\pN!#$%&*+/=?^_`{|}~-]{1,64}@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)+$"
r"^[a-zA-Z0-9.\pL\pN!#$%&'*+/=?^_`{|}~-]{1,64}@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)+$"
).unwrap();
static ref HOST_FORMAT: Regex = Regex::new(r"^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*$").unwrap();
static ref SENDER_NAME_FORMAT: Regex =
@@ -108,6 +108,7 @@ fn email_address() {
"a@{}.b",
random_alphanum_string(249)
)));
assert!(validate::email_address("a'b@example.com"));
}

#[test]
@@ -125,6 +126,7 @@ fn invalid_email_address() {
"a@{}.b",
random_alphanum_string(250)
)));
assert!(!validate::email_address("a’b@example.com"));
}

#[test]

0 comments on commit b16f52e

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.