Impossible to say, without knowing the implementation details of the regexp package you're using. The only way to be sure would be testing in a profiler.
Note that there are a number of string-searching algorithms that are faster than brute-force linear search (look up the Boyer-Moore algorithm, for example). Good regexp packages tend to use such algorithms, but the regexp object itself introduces some overhead.
Honestly, I would code up the simplest thing I could think of, then run the whole program through a profiler ONLY IF performance was a demonstrable issue. Only at that point would I consider retooling the string search, and then only if it proved to be a significant bottleneck. Premature optimization is the root of all evil.
Bookmarks