How to strip color codes used by mIRC users?

前端 未结 6 1530
小鲜肉
小鲜肉 2020-12-16 06:15

I\'m writing a IRC bot in Python using irclib and I\'m trying to log the messages on certain channels.
The issue is that some mIRC users and some Bots write using color

6条回答
  •  粉色の甜心
    2020-12-16 06:51

    I even had to add '\x0f', whatever use it has

    regex = re.compile("\x0f|\x1f|\x02|\x03(?:\d{1,2}(?:,\d{1,2})?)?", re.UNICODE)
    regex.sub('', msg)
    

提交回复
热议问题