|
-
Jul 6th, 2002, 08:48 PM
#1
Thread Starter
Stuck in the 80s
str_replace
Are str_replace and preg_replace case sensitive?
-
Jul 6th, 2002, 08:48 PM
#2
Member
Believe so *looks at the docs*
-
Jul 6th, 2002, 08:49 PM
#3
Member
str_replace:
[email protected]
27-May-2001 11:58
It should be noted in the docs that str_replace() is Case Sensitive. This
makes sense of course, as that is the quickest way to solve problems. It
would be interesting to see something like stri_replace(), an insensitive
replace. Hmm..(goes to check CVS)
-
Jul 6th, 2002, 08:50 PM
#4
Member
...and preg_replace:
[email protected]
19-Apr-2002 10:04
If you want to quote strings case insensitively, without altering the case
of the actual match (like google does) :
$text = "Reading the documentation is allways recommanded, and the
PHP manual is worth a read";
$search = "read";
$text =
preg_replace("'$search'i","<b>\\0</b>",$text);
/*
* will output :
* <b>Read</b>ing the documentation is allways
* recommanded, and the PHP manual is
* worth a <b>read</b>.
*
*/
-
Jul 6th, 2002, 09:25 PM
#5
Thread Starter
Stuck in the 80s
damn, then how can you do a normal case insensative replace?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|