title: Replace regular expression javascript
body: <p>I have a string like this</p>
  
  <p><code>|1.774|1.78|1|||||1.781|1||||||||</code></p>
  
  <p>I applied a replace expression </p>
  
  <pre><code>str = str.replace(/\|\|/g, '| |')
  </code></pre>
  
  <p>Output result is </p>
  
  <pre><code>|1.774|1.78|1| || ||1.781|1| || || || |
  </code></pre>
  
  <p>but the result must be like</p>
  
  <pre><code>|1.774|1.78|1| | | | |1.781|1| | | | | | | |
  </code></pre>
  
  <p>Where is the error?
  Thanks</p>