Next / Previous / Contents / Shipman's homepage

10.4. YYYY_MM_XML_PAT: Month file name pattern

This pattern matches the name of a monthly file such as '2005-09.xml'. Note that it will match invalid month names such as '1999-00.xml' and '2008-19.xml', but that is hardly a world-shattering defect.

noteweb
YYYY_MM_XML_PAT  =  re.compile (
    r'[12]\d{3}'    # Matches 1000-2999
    r'\-'           # Matches '-'
    r'[01]\d'       # Matches 00-19
    r'\.'           # Matches '.'
    r'xml'          # Matches 'xml'
    r'$' )          # End-of line anchor: insure a complete match