in reply to Re: Regular expression quantifiers and the /gsmx modifiers
in thread Regular expression quantifiers and the /gsmx modifiers

I removed the ^ and $ notations in your regex, and your matching worked perfectly...

Of course, the reason is that a newline  \n is a member of the  \s regex character set, and there is an abundance of  \s* in the modified regex.