note 64977 added to function.preg-replace
| From: | ToadMonkey at osu1 dot php dot net | Date: | Mon, 24 Apr 2006 04:07:57 +0000 |
| Subject: | note 64977 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-109277@lists.php.net to get a copy of this message | ||
After saving the contents of a URL to a varialbe ($url_file) perform regular expresions on it to
find all text words in CAPITAL letters and change to small letters beginning with capital letter.
Single capital letters should stay the same (capital letters that sentences or names begin with).
ANSWER: $url_file =
preg_replace('/([A-Z]{2,}){1}/e',"ucfirst(strtolower('$1'))",
$url_file);
----
Server IP: 64.71.164.2
Probable Submitter: 24.117.193.209
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/note/edit/64977
Del: integrated -- http://master.php.net/note/delete/64977/integrated
Del: useless -- http://master.php.net/note/delete/64977/useless
Del: bad code -- http://master.php.net/note/delete/64977/bad+code
Del: spam -- http://master.php.net/note/delete/64977/spam
Del: non-english -- http://master.php.net/note/delete/64977/non-english
Del: in docs -- http://master.php.net/note/delete/64977/in+docs
Del: other reasons-- http://master.php.net/note/delete/64977
Reject -- http://master.php.net/note/reject/64977
Search -- http://master.php.net/manage/user-notes.php