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
Solution to Ubuntu dual system stuck when startin...
We will install phpMyAdmin to work with Apache on...
The docker create command can create a container ...
Application Scenario In the data table, the appli...
Enable the service when you need it, and disable ...
1. Introduction to MySQL permissions There are 4 ...
Table of contents 1. Download MySQL 1.1 Download ...
Table of contents 1. Subquery definition 2. Subqu...
1. Simple configuration of nginx's dynamic an...
The innodb_autoinc_lock_mode parameter controls t...
docker attach command docker attach [options] 容器w...
nginx installation Ensure that the virtual machin...
1. Introduction to Docker 1.1 Virtualization 1.1....
Mysql5.5 dual machine hot standby Implementation ...
Table of contents The browser's rendering mec...