If you need to replace SQL statements with mysqlupdate regular expressions, refer.
If you need mysql update Regular Expression replacement SQL statements, refer to it.
The following update statement replaces test in www.test.com with abc.
UPDATE table name SET field name = REPLACE (REPLACE the previous field value, 'replace the previous keyword ', 'replace the previous keyword') WHERE field name REGEXP "REPLACE the previous field value ";
Example:
| The Code is as follows: |
|
UPDATE test SET
Url = REPLACE ('www .test.com ', 'test', 'abc ')
WHERE url REGEXP "www.test.com "; |
If there is a similar
Www.test.com
Www.test1.com
Www.test2.com
To change all these records to www.abc.com, execute the following SQL statement:
| The Code is as follows: |
|
|
UPDATE test SET
Url = REPLACE ('www .test.com ', 'test', 'abc ')
WHERE url REGEXP '^ (www. test )'; |
Regular Expressions are very flexible, but in complex cases, the efficiency of regular expressions is not necessarily higher than that of other methods, and it is not necessarily necessary to hold a tree, sometimes you may learn more by trying a new method.