Re: [DONE] Substr by words
| From: | Marcus Bointon | Date: | Mon, 31 Oct 2005 10:18:42 +0000 |
| Subject: | Re: [DONE] Substr by words | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224868@lists.php.net to get a copy of this message | ||
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@synchromedia.co.uk | http://www.synchromedia.co.uk