I have a string named MESSAGE and it varies depending on what people say.
Is there a way I can make MESSAGE replace the contents of a string inside of a string?
For example, if MESSAGE is equal to "Hey guys [rainbow]look at my awesome rainbow text[/rainbow] isn't it cool?" then how do I only replace the "[rainbow]look at my awesome rainbow text[/rainbow]" part by getting rid of "[rainbow]" and "[/rainbow]" and replacing "look at my awesome rainbow text" with a string called RAINBOWTEXT?
The reason I need this is because I would like users in my Flash-based chat to be able to make rainbow text, but the method I use needs to do this client-side. I did have a PHP version that would submit the text into the database, but it would cut the message off due to the large amount of data. Each character got a <font color="#123456"> and a </font> on either side of it, so messages were super long.
If I can replace the inside part of what is specified by [rainbow] and [/rainbow], I can have each person's client replace the message once it gets it. In the database, it will have "Hey guys [rainbow]look at my awesome rainbow text[/rainbow] isn't it cool?" but in chat it will have "Hey guys look at my awesome rainbow text isn't it cool?" with the actual text rainbowfied.