(patt, flags=0)
return (compile_regexp, opattern)
returns a compile regular expression object
returns a compile regular expression object
returns a compile regular expression object
def make_pattern(patt, flags=0):
    """
    returns a compile regular expression object
    """
    # print('input',len(patt))
    patt_letters = utf8.get_letters(patt)
    patt_out = list()
    idx = 0
    # print('output',len(patt_letters))
    patt = [None, None]
    prev = None
    LEN_PATT = len(patt_letters)
    while idx < LEN_PATT:
        if utf8.istamil(patt_letters[idx]) and (
                prev == "-" or ((idx + 1) < LEN_PATT and patt_letters[idx + 1] == u"-")
        ):
            if (idx + 1) < LEN_PATT and patt_letters[idx + 1] == u"-":
                patt[0] = patt_letters[idx]
                idx = idx + 2
                prev = "-"
            elif prev == "-":
                patt[1] = patt_letters[idx]
                patt_out.extend(expand_tamil(patt[0], patt[1]))
                idx = idx + 1
                prev = patt_letters[idx]
            continue
        patt_out.extend(patt_letters[idx])
        prev = patt_letters[idx]
        idx = idx + 1
    opattern = u"".join(patt_out)
    compile_regexp = re.compile(opattern, flags)
    return (compile_regexp, opattern)
def make_pattern ( patt , flags = 0 ) : # print('input',len(patt)) patt_letters = utf8 . get_letters ( patt ) patt_out = list ( ) idx = 0 # print('output',len(patt_letters)) patt = [ None , None ] prev = None LEN_PATT = len ( patt_letters ) while idx < LEN_PATT : if utf8 . istamil ( patt_letters [ idx ] ) and ( prev == "-" or ( ( idx + 1 ) < LEN_PATT and patt_letters [ idx + 1 ] == u"-" ) ) : if ( idx + 1 ) < LEN_PATT and patt_letters [ idx + 1 ] == u"-" : patt [ 0 ] = patt_letters [ idx ] idx = idx + 2 prev = "-" elif prev == "-" : patt [ 1 ] = patt_letters [ idx ] patt_out . extend ( expand_tamil ( patt [ 0 ] , patt [ 1 ] ) ) idx = idx + 1 prev = patt_letters [ idx ] continue patt_out . extend ( patt_letters [ idx ] ) prev = patt_letters [ idx ] idx = idx + 1 opattern = u"" . join ( patt_out ) compile_regexp = re . compile ( opattern , flags ) return ( compile_regexp , opattern )