I’ve always found that specifying whitespace in an Emacs regex was harder than it should be. If I want anything more than a simple space (or spaces) I always have a difficult time remembering the incantation. Over time, I’ve settled on \s-
, which seems to work in every case I’m interested in.
Marcin Borkowski (mbork) had similar difficulty and has a great post on what he’s discovered. The situation is more complicated than you might think but it all makes sense once you understand what’s going on. The TL;DR is that in almost every case, \s-
is indeed what you want but there are some edge cases worth knowing about. Take a look at Borkowski’s post to see what they are.