Why would this one work:
SELECT REGEXP_REPLACE(REGEXP_REPLACE('[GREY]', '\]', ''), '\[', '')
But these not:
SELECT REGEXP_REPLACE('[GREY]', '[\[\]]', '')
SELECT REGEXP_REPLACE('[GREY]', '/[\[\]]/g', '')
This is the explanation from regex101.com:
/[\[\]]/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)
And Match Information:
Match 1
Full match 0-1 `[`
Match 2
Full match 5-6 `]`