Python Generate Regex Pattern From String