def METHOD_NAME(self, search_string):
    palette = QPalette()
    try:
        self.compileRegex(search_string)
    except Exception as e:
        # From https://stackoverflow.com/questions/27432456/python-qlineedit-text-color
        palette.setColor(QPalette.Text, Qt.red)
    self.searchTextInput.setPalette(palette)