Readability aside, are there any discernable differences (performance perhaps) between using
str.indexOf("src")
and
Using indexOf
should, in theory, be faster than a regex when you're just searching for some plain text, but you should do some comparative benchmarks yourself if you're concerned about performance.
If you prefer match
and it's fast enough for your needs then go for it.
For what it's worth, I agree with your colleagues on this: I'd use indexOf
when searching for a plain string, and use match
etc only when I need the extra functionality provided by regular expressions.