PHP functions
I sometimes find writing regular expressions of any complexity difficult. That’s true, though it would be more accurate if I’d said always.
It’s not because regular expressions themselves are difficult (though there is a lot to remember, or look up), but it can be so easy to make mistakes and so difficult to find those mistakes in that confusing mass of characters.
Eventually I give up and make a dedicated PHP file just to test the regular expression against various inputs. In fact, I have done the same with other functions to ensure that they do what I expect them to.
(more…)