Re-wrote regexes and code to use re.IGNORECASE flag for readability and simplicity