Replace or Match Split

Benchmark created by Jenna on


Preparation HTML

<script>
  var string = 'http://www.blah.com?something=test&category=20&another=me';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Replace
var test = string.replace(/(.+)category=([0-9]+)(.+)/ig, '$2');
ready
Match Split
var test = string.match(/category=([0-9]+)/ig)[0].split('=')[1];
ready

Revisions

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

  • Revision 1: published by Jenna on