adjusted regex groups to live with python3, fixes #786

tested on python 2.7.5+ and 3.3.2+