Post

Replies

Boosts

Views

Activity

Range string return incorrect with regularExpression option when we run in iOS 17 developer beta.
Hi, I'm an iOS developer who found an issue with the regularExpression option in the range method of the string. The return value differs between iOS 17 beta 1 and iOS 16, even when using the same regex pattern and input. Build with XCode14.2 // Regex pattern to check thousand amount pattern but comma is optional. // 10000 => Correct // 1000,0 => Incorrect let regex = "^[+-]?[0-9]{1,3}(?:,?[0-9]{3})*$" let rangeOf10000 = "10000".range(of: regex, options: .regularExpression) let rangeOf100000 = "100000".range(of: regex, options: .regularExpression) // in iOS 17.0 developer beta // rangeOf10000 = nil // rangeOf100000 = got an object normally. // in iOS 16.2 // rangeOf10000 = got an object normally. // rangeOf100000 = got an object normally. I don't know if the defect in the range method or my missing something in the regex pattern such a long time, but I wonder why rangeOf10000 is nil in iOS 17 beta 1.
3
0
958
Jun ’23