I have a config.ini file formed as XML like that :
<positions>
<position>
<name>BLOCK TAB 1</name>
<tag>[BLOCK_TAB_1]</tag>
</position>
<position>
<name>PERSONALAREA</name>
<tag>[PERSONALAREA]</tag>
</position>
</positions>
I tried to remove the block :
<position>
<name>BLOCK TAB 1</name>
<tag>[BLOCK_TAB_1]</tag>
</position>
by using preg_replace
$find1 = "/<name>BLOCK TAB 1<\/name>/";
$find2 = "/<tag>\[BLOCK_TAB_1\]<\/tag>/";
$contents = preg_replace($find1, "", $contents);
$contents = preg_replace($find2, "", $contents);
But the content will be
<positions>
<position>
</position>
<position>
<name>PERSONALAREA</name>
<tag>[PERSONALAREA]</tag>
</position>
</positions>
The empty <position>
tag ( with tabs inside ) still here.
Try to use /<position[^>]*><\\/position[^>]*>/
to replace empty <position>
tag, but because of tabs inside, so replace is not working.
Somebody have idea ?