def contains_regex(path, regex, lchar=''):
    path = os.path.expanduser(path)

    if not os.path.exists(path):
        return False

    try:
        with salt.utils.fopen(path, 'r') as target:
            for line in target:
                if lchar:
                    line = line.lstrip(lchar)
                if re.search(regex, line):
                    return True
            return False
    except (IOError, OSError):
        return False
.. deprecated:: 0.17.0
dataset/ETHPy150Open saltstack/salt/salt/modules/file.py/contains_regex