Unify regex and whole-word matching into a single scan pass and avoid per-line substring allocations by searching the full logical line with lastIndex. Forward non-whole-word regex keeps a single-exec fast path. Co-authored-by: Cursor <cursoragent@cursor.com>