I have an html with a lot of id="something"
attributes.
All the html is inside $data
var.
Trying to remove all the id="*"
from $data
:
$data = preg_replace('\<id="[*]"^\>', '', $data);
Doesn't work, whats wrong?
Try this instead:
$data = preg_replace('#\s(id|class)="[^"]+"#', '', $data);
Note: We solved the remaining issues in chat. The answer still fits the problem described in the question.
try the following:
'id="[^"]*"'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With