string split vs regex (v3)

Revision 3 of this benchmark created on


Setup

const text = 'Base.1.0.56745675467.PasswordChangeRequired';
const regex = new RegExp('^Base\\.\\d+\\.\\d+\\.\\d+.\\PasswordChangeRequired$');

Test runner

Ready to run.

Testing in
TestOps/sec
split
const words = text.split('.');
words[4]=== 'PasswordChangeRequired' && words[0] === 'Base'
ready
regex match
text.match(regex) !== null
ready

Revisions

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