Do you test your code before posting? Why are you using set_task? When comparing a single char you can do x == '*'. Please don't try to help others if you don't know how to correctly do things.
This can be done more efficiently by locating the position in the string where the two asterisks are and use a copy() for the text found between the two, using position 2 - position 1 + 1 as the number of chars to copy and text[ Pos1 + 1 ] as the start position to copy. I'll show you later if you can't figure it out.
I think I've got the idea. If you want to post an example it'd be appreciated but I'll my an attempt until then.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.