I want to create a regular expression to get only the lines that start with a date(ignore the other ones) and the ones that have the word "Prefix" on it. How should the regular expression looks like?
I have the following structure in my txt file:
                                                        Prefix : 0051601
    Data     Material                                       No. OS  Hist. Nr/Controle        Quant.       Vlr.Unit.            Vlr.Total 
 ----------------------------------------------------------------------------------------------------------------------------------------
 13/01/2008  00101050 Lampada farol H5 24V                          003   4863                2,000        9,870556              19,7411 
                                                                                        ====== Total dia 13/01/2008 ======
                                                                     Entradas :                                                         
                                                                     Saídas   :               2,000                              19,7411
                                                                     -------------------------------------------------------------------
And the primary code is:
import glob, os
import re
os.chdir("./txtfiles/")
for file in glob.glob("*.txt"):
    with open(file) as f:
        content = f.readlines()
        # not working, just for test purpose
        result = re.match(r'Prefix', content, re.M|re.I)
        if result:
            print(content)
        else:
            print "no match found!"
 
    