Because, when the (\s|$) at the end matches \s (a space), this space
is no longer included in subsequent matches - as if that part of
string "disappeared" - and thus the \s at the beginning can't match
it. You should use a regex tester for complex regexes (by complex, I
mean almost all), for example http://regexpal.com/. (Try inputting
your data and both of your regexes there.)

I think there's a similar tool that explicitly uses Ruby's flavor of
regexp (regexpal uses browser-side JavaScript), but I can't remember
the URL and AFAIR it sucked.

-- Matma Rex