title: Match Naming Convention of Text File Regex
body: <p>I am trying to find text files with a certain naming convention using regex, but have so far been unsuccessful.</p>
  
  <p>The naming convention is <code>file_[year]-[month]-[day].txt</code> (eg. file_2010-09-15.txt).</p>
  
  <p>Here is what I have so far: <code>^(file_)[0-9]{4}[-][0-9]{2}[-][0-9]{2}(\.txt)$</code></p>
  
  <p>I'm trying to use it in my code like this: </p>
  
  <pre><code>    for text_file in os.listdir(path):
          if fnmatch.fnmatch(text_file, '^(file_)[0-9]{4}[-][0-9]{2}[-][0-9]{2}(\.txt)$'):
              # print number of files found
  </code></pre>