Linked Questions

Popular Questions

How to replace text in html tag?

Asked by At

I have a string

$text =<<<HTML
<div align="center"><center><img src='' alt="The Birthday of the World: And Other Stories"/></center><br/>
thanks all "coder". </div>


I want to replace all " from tag with \" or ' with \' and don't replace if " or ' not in tag

so result is

  $text =<<<HTML
    <div align=\"center\"><center><img src=\'\' alt=\"The Birthday of the World: And Other Stories\"/></center><br/>
     thanks all "coder".

Please help me . Great Thanks

Related Questions