title: How to match whitespace, carriage return and line feed using regular expression in PHP?
body: <p>I am working with a regular expression in PHP. I have the following string: </p>
  
  <pre><code>&lt;img 
  src="/files/admin/hotel_website.gif" alt="Go To The Hotel's Web 
  Site" align="absmiddle" border="0" class="hotel_icon" /&gt;
  </code></pre>
  
  <p>This string contains carriage return and line feed characters.</p>
  
  <p>I want my regular expression to replace html img tags with IMG but this does not work with the above text.</p>
  
  <p>I discovered it contained these characters by looping through each character in the string and printing out the hexadecimal representation which can be found here (<a href="http://pastebin.com/ViNdBsRV" rel="noreferrer">http://pastebin.com/ViNdBsRV</a>). </p>
  
  <p>Here is my regular expression:</p>
  
  <pre><code>strip_tags(preg_replace('/^\s*&lt;img\s*.*\/?&gt;\s*$/i', '[IMG]', $test));
  </code></pre>
  
  <p>Appreciate the help.</p>