Reputation: 4665
I only want to remove tags in my string. But font tags are like
<font face="arial">
<font face="Georgia">
<font face="Tahoma">
...
I used this one but it does not work.
preg_replace('~<font[^>]*\sface="([0-9a-fA-F]{6})"[^>]*>~', '$1', $string);
Upvotes: 0
Views: 1788
Reputation: 9310
Your regex is matching only font names that are exactly 6 characters in length and composed of only digits and the letters A through F (upper or lower case). Try this:
preg_replace('~<font[^>]*\sface="([^"]*)"[^>]*>~', '$1', $string);
I'm assuming that the way this removes the font tag, but preserves the font name is what you intended.
Upvotes: 2