regex test

Benchmark created on


Setup

const text="I don't know what I'm doing"

Test runner

Ready to run.

Testing in
TestOps/sec
non-regex
const isString = (typeof text !== 'string');
const apostropheVariations = ['‘', '’', '`', 'ʼ'];
apostropheVariations.reduce(
    (acc, char) => acc.split(char).join("'"),
    text
);
ready
regex
const isString = (typeof text !== 'string');
const apostropheRegex = /[‘’`ʼ]/g;
return text.replace(apostropheRegex, "'");
ready

Revisions

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