Attempting regex on a HTML file with the following code:
<body style=""><p class="Normal" style="direction:ltr;unicode-bidi:normal;"><span class="Normal-H"><span class="-H" style="font-weight:bold;"></span><span class="-H" style="font-weight:bold;">Some bold text</span></span></p><p class="Normal" style="direction:ltr;unicode-bidi:normal;"><span class="Normal-H"><span class="-H" style="font-style:italic;"></span><span class="-H" style="font-style:italic;">Some italic text</span></span></p></body></html>
Note the <span class="-H" style="font-weight:bold;">Some bold text</span>
I am currently using PHP preg_replace '/<span class="-H" style="font-style:italic;">(.*?)<\/span>/', to replace as <strong>Some bold text</strong>however this is limited to spans with the class "-H"
How might I replace any instance of <span> that includes the attribute style="font-weight:bold;" with <strong>Bold text</strong>?
Thanks
Your RegEx should be:
You should place the the text into strong tag like this:
Tested at http://www.regular-expressions.info/javascriptexample.html