add mysql function to get red string from patern