This article uses an example to describe how to use MySQL to implement fuzzy string replacement based on regular expressions. Share with you for your reference, the details are as follows: For example: abcd(efg)hijk after replacement is abcdhijk Copy the code as follows: update tabaleA set name = replace(name, substring(name, locate('<contact>', name), locate('</contact>', name)-locate('<contact>'+10, name)),''); After execution, an error is reported: Truncated incorrect DOUBLE value The solution is that after querying, it was found that the problem was caused by Modify the SQL as follows: Copy the code as follows: update t_global_project set name = replace(name, substring(name, locate('<contact>', name), locate('</contact>', name)-locate(concat('<contact>','10'), name)),''); PS: Here are two very convenient regular expression tools for your reference: JavaScript regular expression online testing tool: Regular expression online generation tool: Readers who are interested in more MySQL-related content can check out the following topics: "Summary of MySQL Common Functions", "Summary of MySQL Log Operation Skills", "Summary of MySQL Transaction Operation Skills", "Summary of MySQL Stored Procedure Skills" and "Summary of MySQL Database Lock-Related Skills". I hope this article will be helpful to everyone's MySQL database design. You may also be interested in:
|
<<: Two ways to completely delete users under Linux
>>: Summary of Vue's common APIs and advanced APIs
Achieve results Implementation Code html <div ...
Table of contents Overview computed watch monitor...
Table of contents First Look Index The concept of...
We often encounter this situation in front-end de...
Newer Linux distributions no longer have the rc.l...
Table of contents Vue2.x Usage Global Registratio...
1. Online installation Currently only tried the L...
Table of contents 1. IDEA downloads the docker pl...
You can have the best visual design skills in the...
After installing Navicat The following error may ...
Table of contents question Solution question Ther...
This article example shares the specific code for...
Table of contents javascript tamper-proof object ...
Recently, I participated in the development of th...
1. Technical points involved vite version vue3 ts...