I'm using helm-swoop to search within the current buffer using regular expressions. My goal is to find lines containing a whitespace character followed immediately by the digit 4.
Consider a buffer containing the line:
I've been here 4 years When I run M-x helm-swoop and enter the pattern \s4 in the prompt, it fails to find any matches, even though \s is a standard regex shorthand for whitespace.
However, if I use the POSIX bracket expression for whitespace and search for [[:space:]]4 instead, helm-swoop correctly matches the line.
I have confirmed that fuzzy matching is not interfering (e.g., by setting (setq-local helm-swoop-use-fuzzy-match nil) before searching). I have also ensured helm-swoop starts with an empty prompt using (setq helm-swoop-pre-input-function (lambda () nil)).
Why does the standard \s shorthand not work as expected within the helm-swoop regex search, while the more explicit [[:space:]] POSIX character class does work? Is this expected behavior, related to how Helm or Swoop handles regex input, or potentially a configuration issue?
helm-swoopand have no idea what it is, but try entering\\s4instead. Either way, you should consult its documentation for details.\sin Emacs regexp syntax is for matching character syntax. For whitespace, you can match using\s-