regex.exec vs string.match vs regex.test vs regex.matchFastest: regex.test (1.8x faster)
12,607,750 ops/sec
11,274,996 ops/sec
11,098,955 ops/sec
6,981,392 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| regex.exec | |
| string.match | |
| regex.test | |
| regex.match |
| Test name | Executions per second |
|---|---|
| ✓ regex.test | 53,020,044 Ops/sec |
| regex.exec | 35,986,604 Ops/sec |
| string.match | 32,954,548 Ops/sec |
| regex.match | 32,622,132 Ops/sec |