Skip to content

Commit 132c224

Browse files
committed
Added EmailAddress.regex for simple validation scenarios
1 parent 7a36ce8 commit 132c224

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/EmailAddress/EmailAddress.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,8 @@ extension EmailAddress {
253253
return email
254254
}
255255
}
256+
257+
extension EmailAddress {
258+
/// A non-RFC5322 compliant regex for simple validation scenarios
259+
public static let regex: String = #"^(?!.*\.\.)[A-Za-z0-9](?:[A-Za-z0-9._%+-]{0,62}[A-Za-z0-9])?@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$"#
260+
}

0 commit comments

Comments
 (0)