Fixe base 64 regex format.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
bd9d676c8f
commit
47a75bbd57
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue