Replace use of regular expressions by string formatting

This commit removes regular expressions and replaces it with Python's string formatting syntax, which makes it easier to maintain and read. You can read more about it here: https://docs.python.org/2/library/string.html#formatstrings