I have a string which consists of color codes for some of the words. For example:
[38;2;139;0;0mHello [38;2;255;255;255m[38;2;128;128;128mWorld [38;2;255;255;255m
I need a way to remove these codes. Color code values are dynamics and keep changing but it has a pattern of [38;2;r;g;bm. The regular expression, using the above string, should return 'Hello World'.
I tried regular expression ^.*$ so far but it did not work.
I would like to do this in Python, not Perl, sed or Bash.
Any suggestion how can it be done? Or a valid regex to replace with ''.