import re


def reloc(frame, column, pattern, flags=re.IGNORECASE, method="contains"):
    """
    return rows of frame where the regex pattern is contained in column
    set method to "match" to just check beginnings of strings
    this is case-insensitive by default; adjust flags to modify that
    """
    regex = re.compile(pattern, flags=flags)
    re_method = getattr(getattr(frame[column], 'str'), method)
    return frame.loc[re_method(regex)]