Commit 40e34467 authored by David黄金龙's avatar David黄金龙

通过 email的正则表达式 与Android一致

parent ea15310e
...@@ -251,7 +251,8 @@ extension String { ...@@ -251,7 +251,8 @@ extension String {
var isYHValidEmail: Bool { var isYHValidEmail: Bool {
//更简单 不严格 //更简单 不严格
let regex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" // let regex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let regex = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"
return range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil return range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment