I\'m writing PHP code to parse a string. It needs to be as fast as possible, so are regular expressions the way to go? I have a hunch that PHP string functions are more expe
I think if you want highest performance, you should avoid regex as it helps to minimize effort, but won't have the best performance as you can almost always adjust code using string routines to a specific problem and gain a big performance boost of it. But for simple parsing routines that can't be optimized much, you can still use regex as it won't make a big difference there.
EDIT: For this specific problem you posted I'd favorize string operations, but only because I wouldn't know how to do it in regex. This seems to be pretty straight-forward, except for the hash, so I think regex/string functions won't make a big difference.