Tests:
  • matchAll

    x
     
    const chars = '0123456789ABCDEFGHJKLMNPRSTUVWXY';
    const ma = (stringToMatch) => {
        const regexp = /[0123456789ABCDEFGHJKLMNPRSTUVWXY]/g;
        return [...stringToMatch.matchAll(regexp)].join('');
    };
    console.log(ma("AQFI7"));
    for (let i = 0; i < 1000; i++) {
      const result = ma("AQFI7");
                }
  • replace

     
    const chars = '0123456789ABCDEFGHJKLMNPRSTUVWXY';
    const rep = (stringToReplace) => {
        const regex = new RegExp(`[^${chars}]`, 'g');
        return stringToReplace.replace(regex, '');
    }
    console.log(rep("AQFI7"));
    for (let i = 0; i < 1000; i++) {
      const result = rep("AQFI7");
                }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    matchAll
    replace

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Chrome 97 on Windows
View result in a separate tab
Test name Executions per second
matchAll 954.3 Ops/sec
replace 1858.1 Ops/sec