* Thus wrote Matt Palermo ([EMAIL PROTECTED]):
> Is there a way to replace everything between 2 given strings if it
> exists?  Say I have:
>  
> $str = "replace anything and everything in here.";
>  
> Now I want to replace everything between the word "replace" and "here.",
> so the new string could read something like this:
>  
> $str = "replace NOTHING here.";
>  
> So it keeps the two end points but just replaces everything in the
> middle with a new specified string.  Please help me if you can.  Thanks.

Your looking for ereg_replace:
 ereg_replace('(keep value1).*(keep value2)', '\1\2', $str);

(not tested) 

Of course ereg's get more complicated than that and is probably somthing
worth your while learning. 

then there is preg, more complicate, more powerful, more faster... more
complicated!

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to