import re


def statsmodels_var_regex(variable_name) -> str:
    """
    Generate a regex string that can find all statsmodels parameter names associated with the variable
    1) Categoricals may have the value encoded at the end (for example, Male[T.1.0])
    2) Symbols in the variable name must be accounted for: (, ), -, +, etc
    """
    return fr"^{re.escape(variable_name)}(\[T\..*\])?$"