title: PostgreSQL REGEXP_REPLACE Brackets
body: <p>Why would this one work:</p>
  
  <pre><code>SELECT REGEXP_REPLACE(REGEXP_REPLACE('[GREY]', '\]', ''), '\[', '')
  </code></pre>
  
  <p>But these not:</p>
  
  <pre><code>SELECT REGEXP_REPLACE('[GREY]', '[\[\]]', '')
  SELECT REGEXP_REPLACE('[GREY]', '/[\[\]]/g', '')
  </code></pre>
  
  <p>This is the explanation from regex101.com:</p>
  
  <pre><code>/[\[\]]/g
  
  Match a single character present in the list below [\[\]]
      \[ matches the character [ literally (case sensitive)
      \] matches the character ] literally (case sensitive)
  
  Global pattern flags
      g modifier: global. All matches (don't return after first match)
  </code></pre>
  
  <p>And Match Information:</p>
  
  <pre><code>Match 1
      Full match  0-1 `[`
  Match 2
      Full match  5-6 `]`
  </code></pre>