Can someone tell me why this doesn't work?<div><br></div><div><div><div>colorre = re.compile ('('</div><div>                        '^'</div><div>                       '|'</div><div>                        '(?:'</div>
<div>                           '\x0b(?:10|11|12|13|14|15|0\\d|\\d)'</div><div>                           '(?:'</div><div>                              ',(?:10|11|12|13|14|15|0\\d|\\d)'</div><div>                           ')?'</div>
<div>                        ')'</div><div>                      ')(.*?)')</div><div><br></div><div>I'm trying to extract mirc color codes.</div><div><br></div><div>this works:</div><div><br></div><div>
<div>colorre = re.compile ('\x0b(?:10|11|12|13|14|15|0\\d|\\d)'</div><div>                      '(?:'</div><div>                         ',(?:10|11|12|13|14|15|0\\d|\\d)'</div><div>                      ')?'</div>
<div>                      )</div></div><div><br></div><div>but I wanted to modify it so that it returns me groups of (color code, text after the code), except for the first text at the beginning of the string before any color code, for which it should return ('', text). that's what the first paste above is trying to do, but it doesn't work. here are some results:</div>
<div><br></div><div><div>>>> colorre.findall('a\x0b1,1')</div><div>[('', ''), ('\x0b1,1', '')]</div><div>>>> colorre.findall('a\x0b1,1b')</div><div>[('', ''), ('\x0b1,1', '')]</div>
<div>>>> colorre.findall('ab')</div><div>[('', '')]</div><div>>>> colorre.findall('\x0b1,1')</div><div>[('', '')]</div><div>>>> colorre.findall('\x0b1,1a')</div>
<div>[('', '')]</div><div>>>></div><div><br></div><div>i can easily work with the string that does work and just use group starting and ending positions, but i'm curious as to why i can't get it working teh way i want :/</div>
<div><br></div><div><br></div><div><br></div></div><div><br></div></div></div>