>>>>> "Matt" == Matt Palermo <[EMAIL PROTECTED]> writes:
Matt> Is there a way to replace everything between 2 given strings
Matt> if it exists? Say I have:
Matt> $str = "replace anything and everything in here.";
Matt> Now I want to replace everything between the word "replace"
Matt> and "here.", so the new string could read something like
Matt> this:
Matt> $str = "replace NOTHING here.";
how about something like this (untested)
$newStr= preg_replace("/^(replace).*(here)$/", "${1} NOTHING ${2}", $str);
sort of like in the manual:
http://www.php.net/manual/en/function.preg-replace.php
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php