Regular expression examples

Spread the love

Remove style in html tag

$text = preg_replace(“/style=\”[^\”>]+\”/i”, ”, $text);

e.g.

<span style=”font-family: Georgia, serif;” style=”font-family: Georgia, ‘Times New Roman’, Times, serif; font-size: 16px; line-height: 26px;”>some text</span>

to

<span >some text</span>

Facebook Comments

Published by

Titus Choi

I love technology. Working for information technology. Interested in AVR technology. Playing with RC stuff.