import re


def scraping_txt_file(filetxt):
    """This scrape the data inside text files using regular expression. """
    datum = []
    with open(filetxt, "r", encoding="latin1") as foo:
        for line in foo:  # I think a genertator is imaginable here!
            pattern = re.compile(
                r"(?P<Date_de_transaction>\d{2}.\w{3}.\d{4})\t*"
                r"(?P<Date_inscription>\d{2}.\w{3}.\d{4})\t*"
                r"(?P<Transaction>\d{3})\t*"
                r"(?P<data4>.*|\s)\t{1}"
                r"(?P<Montant>\d{1,4}[,|.]\d{2})"
            )
            matchObjects = re.search(pattern, line)
            if matchObjects:
                datum.append(matchObjects.groups())  # extract a group of dict
    if not datum:
        return None
    return datum