Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
RegEx.test vs. String.includes vs. String.match vs String.matchAll vs String.indexOf
(version: 0)
Comparing performance of:
RegEx.test vs String.includes vs String.match vs String.matchAll vs String.indexOf
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var string = "Hallward glanced round him with a puzzled expression. The room looked as if it had not been lived in for years. A faded Flemish tapestry, a curtained picture, an old Italian cassone, and an almost empty book-case--that was all that it seemed to contain, {{besides}} a chair and a table. As Dorian Gray was lighting a half-burned candle that was standing on the {{mantelshelf}}, he saw that the whole place was covered with dust and that the carpet was in holes. A mouse ran scuffling behind the wainscoting. There was a damp odour of mildew."; var regex = /{{/g;
Tests:
RegEx.test
regex.test(string);
String.includes
string.includes("{{");
String.match
string.match("{{");
String.matchAll
string.matchAll(regex);
String.indexOf
string.indexOf("{{") > -1;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
RegEx.test
String.includes
String.match
String.matchAll
String.indexOf
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
RegEx.test vs String.includes vs String.indexOf
RegEx.test vs. String.includes vs. String.match vs String.indexOf
RegEx.test vs. String.includes vs. String.indexOf
RegEx.matchAll vs includes no match
RegEx.matchAll vs includes with match
Comments
Confirm delete:
Do you really want to delete benchmark?