Converts an MQTT topic with parameters into a regular expression.