How to strip tags in PHP using regex?

AMenethere

New Member
\[code\]$string = 'text <span style="color:#f09;">text</span><span class="data" data-url="http://www.google.com">google.com</span>text <span class="data" data-url="http://www.yahoo.com">yahoo.com</span> text.';\[/code\]What I want to do is get the data-url from all spans with the class data. So, it should output:\[code\]$string = 'text <span style="color:#f09;">text</span>http://www.google.com text http://www.yahoo.com text.';\[/code\]And then I want to remove all the remaining html tags.\[code\]$string = strip_tags($string);\[/code\]Output:\[code\]$string = 'text text http://www.google.com text http://www.yahoo.com text.';\[/code\]Can someone please tell me how this can be done?
 
Back
Top