Jump to content

Archived

This topic is now archived and is closed to further replies.

dedart

html to BBCode

Recommended Posts

Hi, I have a script where I am converting html back to BBCODE for editing and I am having trouble with certain parts of the script

[code]$patterns = array ( "|\<b\>(.*?)\</b\>|s",
                    "|\<i\>(.*?)\</i\>|s",
                    "|\<u\>(.*?)\</u\>|s",
                    "|\<strike\>(.*?)\</strike\>|s",
                    "|\<div style=\"font-size: 14px; color=:#E1B500;\"\>\<b\>QUOTE:\</b\>\</font\>\<div style=\"border: 1px; border-style: solid; background-color: #FFF0B3;\"\>(.*?)\</div\>\</div\>|s");

$replacements = array ( "[ B]\$1[ /B]",
                        "[ I]\$1[ /I]",
                        "[ U]\$1[ /U]",
                        "[ STRIKE]\$1[ /STRIKE]",
                        "[ QUOTE]\$1[ /QUOTE]");[/code]

If I have a html string like: <div style="font-size: 14px; color=:#E1B500;"><b>QUOTE:</b></font><div style="border: 1px; border-style: solid; background-color: #FFF0B3;">SOME TEXT</div></div>

The page will output: [ B]QUOTE:[ /B]
SOME TEXT

I have tried re-arranging the arrays and even adding the bbcode bolds to the html string but nothing seems to be working
CAN SOMEONE PLEASE HELP ME, IT'S DRIVING ME CRAZY

dedart

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.