I have a html string and needs to remove double quote from href of anchor tag.
$content = '<p style="abc" rel="blah blah"> Hello I am p </p> <a href="https://example.com/abc?name="xyz&123""></a>';
should return
$content = '<p style="abc" rel="blah blah"> Hello I am p </p> <a href="https://example.com/abc?name='xyz&123'"></a>';
I have tried
preg_replace('/<a\s+[^>]*href\s*=\s*"([^"]+)"[^>]*>/', '<a href="\1">', $content)
but this removes all attributes from anchor tag except for href. Unable to find out something that can actually works inside href Looking for some php code for the same.