'Return compiled cooked search pattern.'

def getprog(self):

    pat = self.getpat()
    if (not pat):
        self.report_error(pat, 'Empty    regular    expression')
        return None
    pat = self.getcookedpat()
    flags = 0
    if (not self.iscase()):
        flags = (flags | re.IGNORECASE)
    try:
        prog = re.compile(pat, flags)
    except re.error as what:
        args = what.args
        msg = args[0]
        col = (args[1] if (len(args) >= 2) else (-1))
        self.report_error(pat, msg, col)
        return None
    return prog
