regexp cmp

Benchmark created on


Setup

var test = ['abvvbfgb-awfaf', 'abc-', '-abc','fwagfwagewgwrehgwhgewgqwafvwafwaf-wwgfwawg9wgfagw-wfaf-egfwaga', 'a', 'a.ff-aa..--a']

Test runner

Ready to run.

Testing in
TestOps/sec
original
test.map(a => /^[A-Za-z0-9]+([-_.A-Za-z0-9]*[A-Za-z0-9]+)*$/.test(a))
ready
short
test.map(a => /^[A-Za-z0-9](?:[-_.A-Za-z0-9]*[A-Za-z0-9])?$/.test(a))
ready
yuki
test.map(a => /^[A-Za-z0-9]+([._-]*[A-Za-z0-9]+)*$/.test(a))
ready
short 2
test.map(a => /^[A-Za-z0-9]([-_.A-Za-z0-9]*[A-Za-z0-9])?$/.test(a))
ready

Revisions

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