JavaScript Regex match all characters
JavaScript regular expressions (browser) do not have a modifier allowing the dot (.) to match all characters including the newline like the ’s’ modifier does for PERL and PCRE in PHP.
However a cool tip I learnt just recently is that using a character class and it’s negated version will allow you to match all characters. Eg: /[\s\S]/g will match all characters in a JavaScript Regular Expression.
I used this trick in the ASCII to Hex conversion JavaScript code I posted a few days ago and thought to mention it.