It concerns checking whether or not a string starts and ends with "/", which was, as far as I can see the OPs question. I do realize that (s)he asked for a RegEx solution, but the "
Is the one line solution faster than the two line solution?" part made me think that it was not really relevant in which way checking should occur. I would have assumed that
substr was faster than RegExes, because it would just be a simple comparision of an array element (in C -- as I said, I didn't benchmark it, so I am making analogous assumptions) vs. something that hardly could be easier in case of the RegEx. If you say that the RegEx would probably be faster I'll have to believe you, but I don't think that my original reply could really have hurt anyone reading it.
Just my own opinion, though.
CombatSquirrel.
Entropy is the tendency of everything going to hell.