note 81836 added to function.str-split

From: Date: Sat, 15 Mar 2008 04:49:09 +0000
Subject: note 81836 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-137083@lists.php.net to get a copy of this message
Response to "Richard Ayotte 18-Jan-2008 09:27": Slight tweak to prevent the need to call another preg_replace, there were also some bugs in this that I'm surprised didn't get noticed (causing duplicate replaces between the preg_replace calls) :) Please feel free to optimize further. I'm not the best with lookahead/behinds yet. I also removed the :upper/lower: and it seemed to speed things up too. <?php $test = 'CustomerIDWithSomeOtherJETWords'; preg_replace('/(?!^)[A-Z]{2,}(?=[A-Z][a-z])|[A-Z][a-z]/', ' $0', $test)); ?> Shaves off a little time anyway. :) ---- Server IP: 208.69.120.35 Probable Submitter: 76.22.73.161 ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- https://master.php.net/note/edit/81836 Del: integrated -- https://master.php.net/note/delete/81836/integrated Del: useless -- https://master.php.net/note/delete/81836/useless Del: bad code -- https://master.php.net/note/delete/81836/bad+code Del: spam -- https://master.php.net/note/delete/81836/spam Del: non-english -- https://master.php.net/note/delete/81836/non-english Del: in docs -- https://master.php.net/note/delete/81836/in+docs Del: other reasons-- https://master.php.net/note/delete/81836 Reject -- https://master.php.net/note/reject/81836 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137083) next »