Test name | Executions per second |
---|---|
lookbehind | 1996272.9 Ops/sec |
normal | 3227097.8 Ops/sec |
lookforward | 2125050.0 Ops/sec |
var re1 = /^(\d{0,9}(,?(?<=,)\d{0,2})?)(-?(?<=-)(\d{0,9}(,?(?<=,)\d{0,2})?))?$/;
var re2 = /^(\d{0,9}(,\d{0,2})?)(-(\d{0,9}(,\d{0,2})?))?$/;
var re3 = /^((?=(\d{0,9}))\2(,\d{0,2})?)(-((?=(\d{0,9}))\6(,\d{0,2})?))?$/;
re1.test('25500,33-33090,770');
re2.test('25500,33-33090,770');
re1.test('25500,33-33090,770');