/s modifier. Normally the
. meta-character will match anything except a newline; the
We can get around this by using a character class like so:
[\s\S]. Common character classes often have short-hand names. For example,
\s is often used to mean ‘any whitespace character’, e.g. as if it were
[ \t\r\n]. The capital letter versions represent the inverse. That means
[\s\S] means, “Match anything that is either whitespace or is not whitespace,” and that covers all characters.
/s modifier, which would allow us to simply use the
. meta-character. But with a small character class we can achieve the same result.