Looking for non-word characters.

JavaScript performance comparison

Test case created

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Match whole string
var val1 = 'foo_bar', val2 = 'foo bar', val3 = ' foobar', val4 = 'foobar ';

val1.match(/^\w+$/);
val2.match(/^\w+$/);
val3.match(/^\w+$/);
val4.match(/^\w+$/);
pending…
check empty and non-word
var val1 = 'foo_bar', val2 = 'foo bar', val3 = ' foobar', val4 = 'foobar ';

val1 && val1.match(/\W/)
val2 && val2.match(/\W/)
val3 && val3.match(/\W/)
val4 && val4.match(/\W/)
pending…

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

Compare results of other browsers

0 comments

Add a comment