Given this code:
import Foundation
extension String {
func matches( _ pattern : String) -> Bool {
return self.range(of: pattern, options: .regularExpression, locale: Locale(identifier: "tr")) != nil
}
}
print("f\u{0131}le".matches("(?i)^[a-z]+$")) // returns false
print("f\u{0131}le".matches("(?i)^[a-z,\u{0131}]+$")) // true
print("f\u{0131}le".matches("(?i)^[fıle]+$")) // true
print("FLE".matches("(?i)^[fıle]+$")) // true
print("FILE".matches("(?i)^[fıle]+$")) // false
I would have expected that FILE would match "(?i)[1]+$" that is with a dotless-i given the Turkish locale. What am I missing?
-
fıle ↩︎