Fixe base 64 regex format.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts 2018-09-26 11:23:13 +02:00
parent bd9d676c8f
commit 47a75bbd57
1 changed files with 1 additions and 1 deletions

View File

@ -11,7 +11,7 @@ import Foundation
extension String { extension String {
func isBase64() -> Bool { func isBase64() -> Bool {
let base64Predicate = NSPredicate(format: "SELF MATCHES %@", "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$") let base64Predicate = NSPredicate(format: "SELF MATCHES %@", "^[a-zA-Z0-9+/]{43}=$")
return base64Predicate.evaluate(with: self) return base64Predicate.evaluate(with: self)
} }