Page 1 of 1
Newbie regexp
Posted: Fri Mar 05, 2004 7:36 pm
by Bison
Hi,
How do I write the search pattern for the str_replace function in order to replace the string
"<body bgcolor="#ffffff">" with ""?
Thanks in advance.
Posted: Fri Mar 05, 2004 7:46 pm
by markl999
$string = str_replace('<body bgcolor="#ffffff">', '', $string);
Posted: Fri Mar 05, 2004 8:01 pm
by Bison
I have tried that, but "<body bgcolor="#ffffff">" isn't removed.
Posted: Fri Mar 05, 2004 8:08 pm
by markl999
Works fine here. Eg
Code: Select all
<?php
$string = 'foo bar <body bgcolor="#ffffff"> flibble';
$string = str_replace('<body bgcolor="#ffffff">', '', $string);
echo $string;
?>
Maybe you should post an example of your code?
Posted: Fri Mar 05, 2004 8:25 pm
by Bison
Here as well. I had a spelling mistake. Sorry.