我正在寻找一个正则表达式,用于替换所有括号和括号以及String中一对之间的Content。
我regexp_replace(str_col, '\[(.*?)\]')
与Amazon redshift一起使用,但这仅替换括号,而不替换其中的内容。
由于Amazon Redshift仅支持POSIX正则表达式,因此您需要使用
1)删除所有[...]
字符串:
regexp_replace(str_col, '\\[[^]]*]')
2)删除所有(...)
字符串:
regexp_replace(str_col, '\\([^)]*\\)')
3)删除两者:
regexp_replace(str_col, '\\[[^]]*]|\\([^)]*\\)')
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句