Match any character using regex

Benchmark created by Mathias Bynens on


Setup

var str = '\n\r\tabc.def123';

Test runner

Ready to run.

Testing in
TestOps/sec
[\s\S]
str.replace(/[\s\S]/g, '');
ready
[^]
str.replace(/[^]/g, '');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Mathias Bynens on