Is /[\s\S]/ the same as saying /.|\n/ in regex
10:43 11 Aug 2026

I assumed in regex that saying:

/[\s\S]/

means the same as saying:

/.|\n/

But then I discovered that in JavaScript the line separator <0x2028> and the paragraph separator <0x2029> do not match on:

/.|\n/

I find this odd, seeing that all the other zero-width unprintable characters fall into the expression:

/./

So why is it not the same for <0x2028> and <0x2029>? They seem to be the only two unicode characters that aren't treated as either /./ or /\n/ in Javascript.

javascript regex