             var searchRange = scopeRange
             
             while searchRange.location != NSNotFound {
-                searchRange.length = string.length - searchRange.location
-                let foundRange = string.range(of: findString, options: options, range: searchRange)
+                searchRange.length = nsString.length - searchRange.location
+                let foundRange = nsString.range(of: findString, options: options, range: searchRange)
                 
                 guard foundRange.max <= scopeRange.max else { break }
                 

    
    
    /// enumerate matchs in string using regular expression
    private func enumerateRegularExpressionMatchs(in string: String?, ranges: [NSRange], using block: (NSRange, NSTextCheckingResult?, inout Bool) -> Void, scopeCompletionHandler: ((NSRange) -> Void)? = nil) {
        
        guard let string = string, !string.isEmpty else { return }
        
        let regex = self.regex()!
        let options: NSRegularExpression.MatchingOptions = [.withTransparentBounds, .withoutAnchoringBounds]

    
    
    /// enumerate matchs in string using current settings
    private func enumerateMatchs(in string: String, ranges: [NSRange], using block: (NSRange, NSTextCheckingResult?, inout Bool) -> Void, scopeCompletionHandler: ((NSRange) -> Void)? = nil) {
        
        if self.settings.usesRegularExpression {
            self.enumerateRegularExpressionMatchs(in: string, ranges: ranges, using: block, scopeCompletionHandler: scopeCompletionHandler)
