import re


def extract_line_from_file(filename, str_search, num=False, integer=False):
    """
    uses regular expression to search a string in a file
    :param filename: the file to be searched in
    :param str_search: the string to search for
    :param num: should a number be extracted?
    :param integer: should an integer be returned? if False and num=True then a float will be returned
    :return: True/False for a sentence
                integer if num=True and integer=True
                float if num=True and integer=False
    """
    with open(filename, "r") as fh:
        for line in fh:
            line = line.strip()
            if num:
                tmp = re.search(str_search + ".*?(\d+)", line)
                if tmp:
                    return int(tmp.group(1)) if integer else float(tmp.group(1))
            else:
                tmp = re.search(str_search, line)
                if tmp:
                    return True
        return False