Peter Dorsi wrote:
Hi,
I am trying to replace (delete actually) sections of code that are being pulled from another site. I want to delete all the code between two distict tags for formatting. Is there a way to do this?
Try a concatenation with a wildcard...
This removes from first occurance of starting string to very last occurance of ending string:
$new_string = ereg_replace(\"$starting_string(.*)$ending_string\",\"\",$original_string);
To delete from beginning of doc to string:
$new_string = ereg_replace(\"(.*)$ending_string\",\"\",$original_string);
To delete from string to very end of doc:
$new_string = ereg_replace(\"$starting_string(.*)\",\"\",$original_string);
Of course, I have seen exceptions.