i want to search for all the <font> tags in my page and replace it with the <span> tags with i need to capture their attributes too ( face, size, color ...) so that i can apply certain style sheets to the new tags. can anybody help me please ? thanks
For just about every post in this forum, there are several valid solutions.
Every post is either someone looking for an answer or offering help.
That is obvious, baby, this is a forum, and that's what people do at forums, its great that you discovered that fact at least now.
Quote:
Although you may consider find and replace an obvious solution, it is not the only solution, and it may not be the best.
The OP did not mention the fact that he was trying to replace stuff entered in text-fields by users. The way he said it, it would look like he was trying to replace bits of code in his own html pages he was trying to make, unless one had tentacles that can detect what the other person is thinking. OP must have made sure that everyone understands his question with ease, and must have mentioned what exactly it is that he is trying to do.
Quote:
Offer your assistance with respect.
This is a forum, not a court room. Most of us are here coz we like helping people and having fun on the way, and not to criticize how others are answering. I have not crossed general boundaries of 'respect' by indicating that the solution was obvious, and there's no need for you to feel so stuffed about it.
Thanks so much for your answers but I'm looking for a way to do that in PHP I also tried many regex by myself but nothing happened . Can someone provide me an example please ?
echo $html; // the output is // <span style="font-family:Tahoma"><span face="Verdana"><a href="http://google.com">Google</a></span> // ??? ?>
I'm a newbie with regex so I did this stupid things The "size" works fine but the "face" doesn't . And even the 2 work then after the replacement there would be 2 "style" attributes so I'm looking for a way to get rid both of them but I have no luck
kinda complicated but i think i tackled it pretty well. conversion table due to the inconsistency with font size without a unit and style font-size. Size conversions appear to be true in FF3 and IE7
+ and - size default to medium in css if they exceed +-3
also didnt take in account percent values
didnt check if all font face's are fine as is in style font-family
umm, what else? well feel free to ask if theres anything unclear about the code or why its done