Skip to main content
Topic: mysql - Removing some old bbcode (Read 2856 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

mysql - Removing some old bbcode

I have managed to change some old bbcode not used anymore on elkarte. I used
Code: [Select]
UPDATE [icode]elkarte_messages[/icode] SET [icode]body[/icode] = REPLACE([icode]body[/icode],'text1','text2')
I had an old version of tapatalk that was not supporting emoticons and now I have some bbcode like [emoji2] or [emoji123]

How could I remove all these old bbcodes? Thank you
sorry for my bad english

Re: mysql - Removing some old bbcode

Reply #1

Do you want to replace them with something or just nothing?
Bugs creator.
Features destroyer.
Template killer.

Re: mysql - Removing some old bbcode

Reply #2

I would like to remove them.
sorry for my bad english

Re: mysql - Removing some old bbcode

Reply #3

I forgot regex do not work on replace in mysql... darn.
I guess you have two options:
1) hide them via a function (for example some kind of replacement in parse_bbc) (I'm just throwing out ideas, don't worry about the implementation. ;))
2) for each tag do the replacement like you did in the other cases
3) write a php script to run on the db to convert the codes.
Bugs creator.
Features destroyer.
Template killer.

Re: mysql - Removing some old bbcode

Reply #4

too complicate, I thought there was a simply way to do this. I'll do a simple search and use the method in the first post for every smiley ;)
sorry for my bad english

Re: mysql - Removing some old bbcode

Reply #5

What @emanuele said ...

To my knowledge you can not use wildcards on an update  :(   So your options are if there are just a few combo's you would have to do each one as its own update.  Otherwise its a script that goes post by post and does the wildcard search and remove.

Re: mysql - Removing some old bbcode

Reply #6

Well, the parse_bbc code would look something like:
Code: [Select]
function replace_tapatalk_bbcode($message)
{
    return preg_replace('~\[emoji\d+\]~i', '', $message);
}
Nothing too complex. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: mysql - Removing some old bbcode

Reply #7

I solved this, it took me almost an hour but I replaced manually about 90% of smileys from Tapatalk with my own smileys. I removed the rest of them ;)
sorry for my bad english

Re: mysql - Removing some old bbcode

Reply #8

A heck of a job! :(
Bugs creator.
Features destroyer.
Template killer.

 

Re: mysql - Removing some old bbcode

Reply #9

maybe I was not so clear, I did not edit the post one by one, but I searched the forum for [emoji* and then used the sql command UPDATE.. REPLACE ;) not an elegant solution but I solve it ;)
sorry for my bad english