title: Postgresql regexp_replace 'g' flag
body: <p>i have string<br>
      <code>[[good|12345]] [[bad1 [[bad2 [[bad3 [[bad4 [[bad5 [[good|12345]]</code></p>
  
  <p>i need to kill <code>[[</code> if word havent <code>|</code> after it.</p>
  
  <p>what i do:
  <code>select regexp_replace('[[good|12345]] [[bad1 [[bad2 [[bad3 [[bad4 [[bad5 [[good|12345]]', 
  '\[\[([^\|]+?(\[\[|\Z))', '\1', 'g')</code></p>
  
  <p>what i get:
  <code>[[good|12345]] bad1 [[bad2 bad3 [[bad4 bad5 [[good|12345]]</code></p>
  
  <p>what i want to get:
  <code>[[good|12345]] bad1 bad2 bad3 bad4 bad5 [[good|12345]]</code></p>
  
  <p>it looks like the last 2 symbols of my regexp <code>[[</code> doesn't exists in next iteration of regexp</p>