Changed regex to make agent compatible with python 3.3