unwanted/RegexEngineReDoSSolved.py
def match_star(start, front, end, inp, match_len, regex,regex_offset=0):

    """It matches the data in input 
    which is suurounded by *
    """
    # print("Inside match_star :")
    # print("start = ")
    # print(start)
    # print("front = ")
    # print(front)
    # print("end = ")
    # print(end)
    # print("inp = ")
    # print(inp)
    # print("match_len = ")
    # print(match_len)
    matched_len = 0

    
    regex_offset = len(regex_g) - len(regex)
    print(regex_offset)
    vertex_offset = index_vertex_map[regex_offset]

    

    # matches the letter by increasing inp
    # by one at each step
    while(1):
        to_check = front * matched_len
        [is_matched, start_len, end_len] = match(
            start, to_check, inp, match_len,
        )
        
        if(not is_matched):
            break
        else:
            matched_len += 1
            # break


    # If the enumeration is more than requied
    # it decreases the length 
    while(matched_len >= 0):
        to_check = (front * matched_len)+end
        [is_matched, start_len, end_len] = match(
            start, to_check, inp, match_len, regex_offset, regex
        )
        if(not is_matched):
            matched_len -= 1
        else:
            if checkKey(vertex_offset_map, regex_offset):
                vertex_offset_map[vertex_offset][inp] = [is_matched, start_len, end_len]
            else:
                vertex_offset_map[vertex_offset] = {}
                vertex_offset_map[vertex_offset][inp] = [is_matched, start_len, end_len]

            return [is_matched, start_len, end_len]

    if checkKey(vertex_offset_map, regex_offset):
        vertex_offset_map[vertex_offset][inp] = [False, None, None]
    else:
        vertex_offset_map[vertex_offset] = {}
        vertex_offset_map[vertex_offset][inp] = [False, None, None]
    return [False, None, None]
It matches the data in input 
    which is suurounded by *
    
It matches the data in input
which is suurounded by
It matches the data in input which is suurounded by
def match_star(start, front, end, inp, match_len, regex,regex_offset=0):
    matched_len = 0
    regex_offset = len(regex_g) - len(regex)
    print(regex_offset)
    vertex_offset = index_vertex_map[regex_offset]
    while(1):
        to_check = front * matched_len
        [is_matched, start_len, end_len] = match(
            start, to_check, inp, match_len,
        )
        if(not is_matched):
            break
        else:
            matched_len += 1
    while(matched_len >= 0):
        to_check = (front * matched_len)+end
        [is_matched, start_len, end_len] = match(
            start, to_check, inp, match_len, regex_offset, regex
        )
        if(not is_matched):
            matched_len -= 1
        else:
            if checkKey(vertex_offset_map, regex_offset):
                vertex_offset_map[vertex_offset][inp] = [is_matched, start_len, end_len]
            else:
                vertex_offset_map[vertex_offset] = {}
                vertex_offset_map[vertex_offset][inp] = [is_matched, start_len, end_len]
            return [is_matched, start_len, end_len]
    if checkKey(vertex_offset_map, regex_offset):
        vertex_offset_map[vertex_offset][inp] = [False, None, None]
    else:
        vertex_offset_map[vertex_offset] = {}
        vertex_offset_map[vertex_offset][inp] = [False, None, None]
    return [False, None, None]
def match_star ( start , front , end , inp , match_len , regex , regex_offset = 0 ) : matched_len = 0 regex_offset = len ( regex_g ) - len ( regex ) print ( regex_offset ) vertex_offset = index_vertex_map [ regex_offset ] while ( 1 ) : to_check = front * matched_len [ is_matched , start_len , end_len ] = match ( start , to_check , inp , match_len , ) if ( not is_matched ) : break else : matched_len += 1 while ( matched_len >= 0 ) : to_check = ( front * matched_len ) + end [ is_matched , start_len , end_len ] = match ( start , to_check , inp , match_len , regex_offset , regex ) if ( not is_matched ) : matched_len -= 1 else : if checkKey ( vertex_offset_map , regex_offset ) : vertex_offset_map [ vertex_offset ] [ inp ] = [ is_matched , start_len , end_len ] else : vertex_offset_map [ vertex_offset ] = { } vertex_offset_map [ vertex_offset ] [ inp ] = [ is_matched , start_len , end_len ] return [ is_matched , start_len , end_len ] if checkKey ( vertex_offset_map , regex_offset ) : vertex_offset_map [ vertex_offset ] [ inp ] = [ False , None , None ] else : vertex_offset_map [ vertex_offset ] = { } vertex_offset_map [ vertex_offset ] [ inp ] = [ False , None , None ] return [ False , None , None ]
It matches the data in input
which is suurounded by
It matches the data in input which is suurounded by
"""It matches the data in input 
    which is suurounded by *
    """ # print("Inside match_star :") # print("start = ") # print(start) # print("front = ") # print(front) # print("end = ") # print(end) # print("inp = ") # print(inp) # print("match_len = ") # print(match_len) # matches the letter by increasing inp # by one at each step # break # If the enumeration is more than requied # it decreases the length 
start
front
end
inp
match_len
regex
regex_offset