         textView.isEditable = false
         
         let highlightColors = NSColor.textHighlighterColors(count: textFind.numberOfCaptureGroups + 1)
-        let lineRegex = try! NSRegularExpression(pattern: "\n")
+        let lineCounter = LineCounter(textFind.string)
         
         // setup progress sheet
         let progress = TextFindProgress(format: .find)




// MARK: - UserDefaults

private extension UserDefaults {

                    let matchedRange = matches[0]
                    
                    // calculate line number
                    let lineNumber = lineCounter.lineNumber(at: matchedRange.location)
                    
                    // build a highlighted line string for result table
                    let lineRange = (textFind.string as NSString).lineRange(for: matchedRange)
