0

I have a weird behavior for my with regex so I hope someone can explain it to me:

let passwordTest = NSPredicate(format: "SELF MATCHES %@", "^(?=.*[A-Z]).(?=.*[0-9]).(?=.*[a-z]).{8,}$")

I want my password to be at least 8 characters. But with the code above it is only allowing passwords more than 8 characters. I used to thought that {8,} means >= and not >.

I know I can just change it to {9,} but I want to make sure that my logic is right, because if searching for this topic I always see that it means >=. So if anyone could just clarify that I'd be grateful :)

Chris
  • 420
  • 6
  • 32

0 Answers0