Replace `.split("\n")` and `.toLowerCase()` loop with a highly optimized
`RegExp` iteration using `indexOf` for fast line number counting.
This significantly reduces memory allocations and CPU cycles when searching
large numbers of lines in the workspace.
Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>