Skip to content

Commit

Permalink
Add emailFilteringRule constant
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonnam committed Dec 13, 2017
1 parent db6b66b commit f725a44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Demo/Navajo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ final class ViewController: UIViewController {
@IBAction func changeValidator(_ sender: UISwitch) {
if sender.isOn {
let lengthRule = LengthRule(min: 2, max: 4)
let emailFilteringRule = RegularExpressionRule(regularExpression: try! NSRegularExpression(pattern: "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}", options: []))
let emailRegularExpression = try! NSRegularExpression(pattern: "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}", options: [])
let emailFilteringRule = RegularExpressionRule(regularExpression: emailRegularExpression)
validator = PasswordValidator(rules: [lengthRule, emailFilteringRule])
} else {
validator = PasswordValidator.standard
Expand Down

0 comments on commit f725a44

Please sign in to comment.