title: Regular expression does not work with PHP
body: <p>This is a continuation to the previous case: <a href="https://stackoverflow.com/questions/48882786/removing-new-lines-containing-spaces">Removing new lines containing spaces</a></p>
  
  <p>Now I have a working regular expression:</p>
  
  <pre><code>R^[ ]{3}$
  </code></pre>
  
  <p>which finds new line and 3 spaces after it.</p>
  
  <p>In PHP I use:</p>
  
  <pre><code>$result = preg_replace('/R^[ ]{3}$/', '', $file);
  </code></pre>
  
  <p>Which should remove such occurrences. However the output remains unchanged. Consider the following example:</p>
  
  <pre><code>UID(*****************ABCDXXX) ALLOW
  
  UID(*****************EFGHXSX) ALLOW
  </code></pre>
  
  <p>There are 3 spaces in line 2. End result should be:</p>
  
  <pre><code>UID(*****************ABCDXXX) ALLOW
  UID(*****************EFGHXSX) ALLOW
  </code></pre>
  
  <p>Since I get input from a file, here is how I output the result:</p>
  
  <pre><code>foreach ($result as $key =&gt; $value) {
      if(!empty($value)) {
          echo  $value . "&lt;br /&gt;";
      }
  }
  </code></pre>
  
  <p>I also tried this regular expression but, as you might gathered, it did not work:</p>
  
  <pre><code>\n.{3}$
  </code></pre>