Bielie, you don't need two text events.
You certainly don't need the if and else condition. I believe if the client that runs the code is already in the channel, join it or not, it won't affect a thing. The is the same for the part, because the running client has to be in the channel to part.
If you're gonna do it that way, that defeats the purpose of using regex in the first place.