I have html with a lot of attributes id="something".
id="something"
All html is inside $datavar.
$data
Trying to remove all id="*"from $data:
id="*"
$data = preg_replace('\<id="[*]"^\>', '', $data);
Doesn't work, what's wrong?
Try this instead:
$data = preg_replace('#\s(id|class)="[^"]+"#', '', $data);
Note. We solved the remaining problems in the chat. The answer still matches the problem described in the question.
try the following:
'id="[^"]*"'
$data = preg_replace('#<id=".*?"/>#', '', $data);
$data = preg_replace('/(<([^>]*))(id=("[^"]*"|[^" >]*))/', '$1', $data);
id = foo ( ") id =