Variable: search-whitespace-regexp
search-whitespace-regexp is a customizable variable defined in
isearch.el.gz.
Value
"[ ]+"
Documentation
If non-nil, regular expression to match a sequence of whitespace chars.
When you enter a space or spaces in the incremental search, it will match any sequence matched by this regexp. As an exception, spaces are treated normally in regexp incremental search if they occur in a regexp construct like [...] or *, + or ?.
If the value is a string, it applies to both ordinary and
regexp incremental search. If the value is nil, or
isearch-lax-whitespace is nil for ordinary incremental search, or
isearch-regexp-lax-whitespace is nil for regexp incremental search,
then each space you type matches literally, against one space.
You might want to use something like "[ \\t\\r\\n]+" instead.
In the Customization buffer, that is [ followed by a space, a
tab, a carriage return (control-M), a newline, and ]+. Don't
add any capturing groups into this value; that can change the
numbering of existing capture groups in unexpected ways.
This variable was added, or its default value changed, in Emacs 28.1.
Probably introduced at or before Emacs version 24.3.
Source Code
;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defcustom search-whitespace-regexp "[ \t]+"
"If non-nil, regular expression to match a sequence of whitespace chars.
When you enter a space or spaces in the incremental search, it
will match any sequence matched by this regexp. As an exception,
spaces are treated normally in regexp incremental search if they
occur in a regexp construct like [...] or *, + or ?.
If the value is a string, it applies to both ordinary and
regexp incremental search. If the value is nil, or
`isearch-lax-whitespace' is nil for ordinary incremental search, or
`isearch-regexp-lax-whitespace' is nil for regexp incremental search,
then each space you type matches literally, against one space.
You might want to use something like \"[ \\t\\r\\n]+\" instead.
In the Customization buffer, that is `[' followed by a space, a
tab, a carriage return (control-M), a newline, and `]+'. Don't
add any capturing groups into this value; that can change the
numbering of existing capture groups in unexpected ways."
:type '(choice (const :tag "Match Spaces Literally" nil)
(const :tag "Tabs and spaces" "[ \t]+")
(const :tag "Tabs, spaces and line breaks" "[ \t\n]+")
regexp)
:version "28.1")