title: C# - Getting file names starting with a specific format in a directory
body: <p>I've a directory with tons of files and I want only to get the names of the ones starting with <code>sly_</code>.</p>
  <p>If I'm not wrong, the patter for this is <code>^sly_</code>.</p>
  <p>This is my try using the solution of <a href="https://stackoverflow.com/a/1601327/742269">this</a> question:</p>
  <pre><code>    string pattern = @&quot;^sly_&quot;;
      var matches = Directory.GetFiles(@&quot;D:\mypath&quot;).Where(path =&gt; Regex.Match(path, pattern).Success);
  
      foreach (string file in matches)
          Console.Write(file); 
  </code></pre>
  <p>Unfortunatelly, this doesn't list the files matching my pattern. So, can someone tell me what's wrong with me code and how can I list the file names starting with <code>sly_</code>?</p>
  <p>Thanks in advance.</p>