Look at the following minimal example: >>> import re >>> p = re.compile(r"(:?Test) (String)") >>> m = p.search("This is a Test String OK?") >>> m.groups() ('Test', 'String')
I would have expected this to produce: ('String') since (:?...) should be a non-capturing group. From the module reference: (?:...) A non-grouping version of regular parentheses. Matches whatever regular expression is inside the parentheses, but the substring matched by the group cannot be retrieved after performing a match or referenced later in the pattern. -- http://mail.python.org/mailman/listinfo/python-list