RegExp.test() vs String.indexOf() (v2)

Revision 2 of this benchmark created on


Setup

const regex = /(?=.*page)(?=.*a=1)(?=.*c=3)/;
const keywords = ['page', 'a=1', 'c=3'];
const url = 'example.com/page/the-cool-page?c=3&a=1&b=2';

Test runner

Ready to run.

Testing in
TestOps/sec
RegExp.test()
regex.test(url);
ready
String.indexOf()
keywords.every(keyword => url.indexOf(keyword) !== -1);
ready

Revisions

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