Fixe base 64 regex format.

This commit is contained in:
Jeroen Leenarts 2018-09-26 11:23:13 +02:00
parent 9cb4d0f50e
commit 189e5181a5
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)
} }