[python] Split string based on a regular expression