- Joined
- Aug 15, 2012
- Messages
- 593
- Reaction score
- 247
- Primarily Uses
There are other String methods that could do the job more efficiently than a regular expression does a lot of the time. The performance difference is probably minimal, really, but it still seems unnecessary and a bit on the arrogant side ("look what I can do!") to use regular expressions when a method such as starts_with? would perform the same function with a little less overhead and a substantial amount more readability. It depends on what they're being used for, basically.I don't doubt they're used in a lot of places where strings would do the job just as well, though with strings being mutable in Ruby, I don't know how much of a performance edge one has over the other.
Oh, and while the history is interesting, you happened to mention it to someone who already knows a little bit about it. (You didn't mention grep, by the way, which is interesting....)

