title: REGEX with PHP on File Name
body: <p>I am atempting to extract the sort code and account number from a filename given that the first 6 figures represent the sort code and the last 8 figures represent the account number. An example of the filename would be:</p>
  
  <pre><code>./uploads/Santander/Statement_01020387654321.qif
  </code></pre>
  
  <p>What I have written does not seem to work, as I am new to regex maybe someone can explain how this should be done, or where I have gone wrong.</p>
  
  <pre><code>$sort = '';
  $acno = '';
  
  $ret = preg_match('/Statment_[0-9]{14}\.(csv|qif|qfx|ofx)$/', $file);
  
  if ($ret)
  {       
      if (ereg ('/_[0-9]{14}\./', $file, $regs))
      {
          $reg = $regs[count($regs)-1];
          $sort = substr($reg, 1, 6);
          $acno = substr($reg, 7, 8);
      }
  }
  </code></pre>