import re


def sub_from_varsub(string, var_sub):
    """Replace the pattern [var_sub] in the string
    with the value of var_sub

    :Arguments:
        1. string(string) = input string which needs substitution
        3. var_sub(string) = value to replace the pattern [var_sub]
                             in the input string
    :Returns:
        1. updated string
    """
    match = re.search(r".*(\[(var_sub)\]).*", string, re.IGNORECASE)
    if match is not None:
        string = string.replace(match.group(1), var_sub)

    return string