MyBB Community Forums

Full Version: use mycode to replace bad <img tag after migration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, I just migrated over from IPB 3.4.x. I've use MyCodes to replace a few things that didn't quite work as planned in the migration, but I can't figure this out...because it works in the AdminCP 

here's my regular expression...I know it seems very specific, but that's because ever instance is consistent:

\<img src='http:\/\/www\.titanspot\.com\/Titan\/public\/style_emoticons\/<(.*?)>\/(.*?)\.(.*?)' class='bbc_emoticon' alt='(.*?)' />

My replacement is simply this:

<img src='/mybb/uploads/style_emoticons/default/$2.$3' />

In the MyBB Sandbox test value, I enter this:
<img src='<#EMO_DIR#>/002.gif' class='bbc_emoticon' alt=':smt002' />
and get this as expected: 
<img src='/mybb/uploads/style_emoticons/default/002.gif' />

But nothing happens in the actual forum.  Any idea what I'm missing here?

I am not saying that I am 100% correct on this, but the format for the regular expression should be:
BBcodes use brackets "[ ] [/]" to convert HTML code. I am not sure if your method will work if the regular expression is not like that. If you are hoping that MyCode will convert messed up html when it's not in bbcode format will not do anything and you have to manually use what you want to bbcode format. The merge system needs to be updated with the HTML conversion problem. Have a staff member confirm this, but that is what my view on why this is not working.
This might be a situation where you want to run an sql query to update the database table instead of reparsing it everytime the post is shown.
I think you're better off with a word filter instead.
I have a simple solution to your problem: