w = 'lllcooooc'
1.
>>> p = re.compile( r'c(.+)c' )
>>> re.sub(p,'',w)
'lll'
>>> matchObj = re.match( p, line)
None
3.
>>> p = re.compile( r'(.+)c(.+)c' )
>>> matchObj = re.match( p, line)
>>> matchObj.group()
'lllcooooc'
>>> matchObj.group(1)
'lll'
>>> matchObj.group(2)
'oooo'
3.5.
>>> p = re.compile( r'c(.+)c' )
>>> matchObj = re.match( p, line)
>>> matchObj.group(0)
'lllcooooc'
>>> matchObj.group()
'lllcooooc'
>>> matchObj.group(1)
'oooo'
>>> matchObj.group(2)
IndexError: no such group
>>> matchObj.groups(0)
('oooo',)
>>> matchObj.groups()
('oooo',)
>>> matchObj.groups(1)
('oooo',)
>>> matchObj.groups(2)
IndexError: no such group
4.
>>> p = re.compile( r'(.+)c(.+)c' )
>>> matchObj = re.match( p, line, re.M|re.I)
ValueError: Cannot process flags argument with a compiled pattern
5.
>>> matchObj = re.match( r'.*c(.*)c', line, re.M|re.I)
>>> matchObj.group(0)
'lllcooooc'
>>> matchObj.group()
'lllcooooc'
>>> matchObj.group(1)
'oooo'
>>> matchObj.group(2)
IndexError: no such group