title: Return substrings of a certain length containing the letter k
body: <p>I have to loop through text files and return substrings found in the text that are either 8 or 9 characters long and contain the letter "k". Some examples of the substrings that must be found: 1998k1748, 1999k426, 2003k3429, 2012k325, etc. What would the regular expression be for this kind of search? I am using PHP.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>This is what I have after using Chirag's expression:</p>
  
  <pre><code>error_reporting(E_ALL);
  
  shell_exec('D:\wamp\bin\xpdf\bin32\pdftotext.exe d.pdf x.txt'); 
  
  $mypdf = file_get_contents("x.txt");
  
  preg_match('\d{4}k\d{3,4}', $mypdf, $result);
  
  echo $result[0];
  </code></pre>
  
  <p>But I get the following error:  Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in D:\wamp\www\pdf2text.php on line 8</p>