and re.IGNORECASE, substitute the result for domain_regex. call the re.compile function with 2 arguments: raw string '\[([A-f0-9:\.]+)\]$' and re.IGNORECASE, substitute the result for literal_regex.
literal_regex = re . compile ( r'\[([A-f0-9:\.]+)\]$' , re . IGNORECASE )