On 31 Oct 2005, at 06:27, Richard Lynch wrote:
There's a certain point where the Regex expression reaches a level of complexity that I'm just not willing to accept in my code and call it "maintainable" / */ is fine, of course. But there's lots of times when I know there must be a one-line regex to replace 10 lines of code, but I don't WANT to use it because I'll stumble over that one-line Regex every time I have to change it.
I quite agree that many regexes are 'write only', but I don't think that that means that using substr and friends is necessarily any clearer. I sometimes find that a nested mass of string functions is even more confusing - at least a regex has a fixed grammar. I've just written a load of stuff that uses preg_replace_callback that I'm quite pleased with.
Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@xxxxxxxxxxxxxxxxxx | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php