RegExp replace-test

Benchmark created by 米空格 on


Test runner

Ready to run.

Testing in
TestOps/sec
replace-1
'<p><a href=\'#url\'>hello</a></p><hr/><p>,<em>world</em></p>'.replace(/<([^>]+)>/g, (a, t) => {
    return /^hr[^a-z]?/i.test(t) ? a : '';
})
ready
replace-2
'<p><a href=\'#url\'>hello</a></p><hr/><p>,<em>world</em></p>'.replace(/<\/?(?!hr)\w+(?:[^>]+)?>/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 米空格 on