先看个官方例子

mysql> SELECT REGEXP_REPLACE('a b c', 'b', 'X');
+-----------------------------------+
| REGEXP_REPLACE('a b c', 'b', 'X') |
+-----------------------------------+
| a X c |
+-----------------------------------+
mysql> SELECT REGEXP_REPLACE('abc def ghi', '[a-z]+', 'X', 1, 3);
+----------------------------------------------------+
| REGEXP_REPLACE('abc def ghi', '[a-z]+', 'X', 1, 3) |
+----------------------------------------------------+
| abc def X |
+----------------------------------------------------+ REGEXP_REPLACE(expr, pat, repl[, pos[, occurrence[, match_type]]]) Replaces occurrences in the string expr that match the regular expression specified by the pattern pat with the replacement string repl, and returns the resulting string. If expr, pat, or repl is NULL, the return value is NULL. REGEXP_REPLACE() takes these optional arguments: pos: The position in expr at which to start the search. If omitted, the default is 1. occurrence: Which occurrence of a match to replace. If omitted, the default is 0 (which means “replace all occurrences”). match_type: A string that specifies how to perform matching. The meaning is as described for REGEXP_LIKE(). Prior to MySQL 8.0.17, the result returned by this function used the UTF-16 character set; in MySQL 8.0.17 and later, the character set and collation of the expression searched for matches is used. (Bug #94203, Bug #29308212) For additional information about how matching occurs, see the description for REGEXP_LIKE().

来点人干的事情:

SELECT REGEXP_REPLACE('哇啦哇啦(报警)', '(.*?)((.*))', '$1$2');
| 哇啦哇啦报警

看来也是支持分组捕获的

最新文章

  1. Hello Point——WebGL
  2. cVim—Chrome上更强大的vim插件
  3. iOS - OC NSUserDefaults 数据存储
  4. POJ 2724 Purifying Machine (二分图匹配)
  5. DNA RNA
  6. setTimeout和setInterval的深入理解
  7. spring bean初始化和销毁
  8. Cocos2d-x 3.x事件分发机制总结
  9. 【英国毕业原版】-《博尔顿大学毕业证书》Bolton一模一样原件
  10. PHP 技能精进之 PHP-FPM 多进程模型
  11. nginx安装,启动亲测有效
  12. 使用Vivado初探ZedBoard的OLED驱动
  13. 第8章 枚举类&注解
  14. 英语专业出身也要走向python
  15. Python安装第三方库,报错超时: Read timed out.
  16. spring boot编译项目打jar包
  17. VMware虚拟机上配置nginx后,本机无法访问问题
  18. 蓝魔i7s刷机
  19. GsonFormat插件主要用于使用Gson库将JSONObject格式的String 解析成实体,该插件可以加快开发进度,使用非常方便,效率高。
  20. json-c开发指南

热门文章

  1. SEO关键词布局方法
  2. 使用 NineData 实现备份集的实时查询
  3. 程序员大杀器?带你玩转ChatGPT
  4. SpringMVC返回值类型及响应数据类型
  5. 调用后台接口实现Excel导出功能以及导出乱码问题解决
  6. setInterval()的使用
  7. C语言排序 冒泡 选择 快排
  8. CSU2022-2023C语言期中考试机试
  9. honoka和格点三角形
  10. CF818G - Four Melody