Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
fix for characters not supported by utf8, such as some emoji (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjsliuj authored and ArtSabintsev committed Mar 31, 2019
1 parent 56255f3 commit b03d788
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Guitar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public struct Guitar {
///
/// - Returns: A list of matches.
public func evaluateForRanges(from string: String, with options: NSRegularExpression.Options = []) -> [Range<String.Index>] {
let range = NSRange(location: 0, length: string.count)
let range = NSRange(location: 0, length: string.utf16.count)
guard let regex = try? NSRegularExpression(pattern: pattern, options: options) else {
return []
}
Expand Down

0 comments on commit b03d788

Please sign in to comment.