I use re.sub() to remove color management codes (IRC) from the string, but it fails every time. This is what I use:
re.sub('\x03(\d*)?,?(\d*)?', '', content)
Error:
File "/usr/lib/python2.7/re.py", line 151, in sub return _compile(pattern, flags).sub(repl, string, count) File "/usr/lib/python2.7/re.py", line 242, in _compile raise error, v # invalid expression error: nothing to repeat
I don't see anything wrong with my regex, so can someone explain what I'm doing wrong?
source share