title: PHP Regex to find and replace a string of 1 or more pipes with just 1 pipe
body: <p>I am trying to replace one or more pipes with just one pipe in a string in PHP.  The below attempt is not working:</p>
  
  <pre><code>$string = preg_replace('/\|+/', '|', $string);
  </code></pre>
  
  <p>Here is a sample of input and the desired output:</p>
  
  <p><strong>Input</strong></p>
  
  <pre><code>only | 1494 | | | | | | Limit: None | | Enr: 22 | | | | | | | | |RE
  </code></pre>
  
  <p><strong>Desired Output</strong></p>
  
  <pre><code>only | 1494 | Limit: None | Enr: 22 | RE
  </code></pre>
  
  <p>Thanks in advance for solving this headache.</p>