为什么这一次会成功:
SELECT REGEXP_REPLACE(REGEXP_REPLACE('[GREY]', '\]', ''), '\[', '')但这些并不是:
SELECT REGEXP_REPLACE('[GREY]', '[\[\]]', '')
SELECT REGEXP_REPLACE('[GREY]', '/[\[\]]/g', '')这是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)和匹配信息:
Match 1
Full match 0-1 `[`
Match 2
Full match 5-6 `]`发布于 2018-04-04 17:16:28
REGEXP_REPLACE将标志(例如g )作为单独的参数:
SELECT REGEXP_REPLACE('[GREY]', '[\[\]]', '', 'g')返回GREY
https://stackoverflow.com/questions/49654819
复制相似问题