Fixes bug since Python 2.7.6 (un-greedy quantifiers in the regex).