You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a string contains extended Unicode characters (like emojis), RegEx are not applied to its entirety.
This is usually unnoticed but when you try to match something at the very end of a string containing emojis, you can spend hours trying to find an issue in your RegEx…
My understanding is that .characters (a String.CharacterView) is extended grapheme clusters, while NSRegularExpression expects an NSRange in terms of UTF-16 code units.
When a string contains extended Unicode characters (like emojis), RegEx are not applied to its entirety.
This is usually unnoticed but when you try to match something at the very end of a string containing emojis, you can spend hours trying to find an issue in your RegEx…
This is probably linked to the NSString/String mapping used for Swift RegEx functions, explained here:
https://stackoverflow.com/questions/29756530/swift-regex-matching-fails-when-source-contains-unicode-characters
Replacing the few occurrences of
by
seems to make everything working fine.
The text was updated successfully, but these errors were encountered: