contains digit (v6)

Revision 6 of this benchmark created by cheesechoker on


Setup

str = "adfklaj;lkjr2adfklaj;lkjr"
    regex = /\d/;
    regex2 = /[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0AE6\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]/;

Test runner

Ready to run.

Testing in
TestOps/sec
Regex
return regex.test(str)
ready
Array
return [].some.call(str, isFinite)
ready
Loop
strLen = str.length 
while(--strLen) {
        switch (str.charAt(strLen)) {
            case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": return true;
        }
    }
    return false;
ready
Expert regex
return regex2.test(str)
ready

Revisions

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

  • Revision 1: published by ad on
  • Revision 2: published by nobodyman on
  • Revision 3: published by nobodyman on
  • Revision 4: published by nobodyman on
  • Revision 5: published by ad on
  • Revision 6: published by cheesechoker on
  • Revision 7: published by James on