Hello all,
Basicly I need to remove / replace all data between 2 tags these tags are constant but the data between them is random.
Thanks in advance 🙂
<? $data = ' some text to keep <tag_to_go>more stuff this can be random stuff</end_tag_to_go>'; // How do I end up with just some text to keep? // Thanks :) ?>
Well, one approach is to use [man]preg_replace/man :
$data = ' some text to keep <tag_to_go>more stuff this can be random stuff</end_tag_to_go>'; $data = preg_replace('/<tag_to_go>.?<\/end_tag_to_go>/', '', $data);
Perfect Thanks 🙂