S
S
Semen553382014-07-15 23:57:34
SQL
Semen55338, 2014-07-15 23:57:34

Is implicit substitution possible in sql query?

There is a Mysql database site on Wordpress
The above for some reason added extra tags to the saved posts of which there are a lot (about 1500) the site of the online store I would like to remove colors of this kind:
<span style="color: #303030;">
by replacing them with just I
<span>
thought about such a request:

UPDATE ds_posts SET post_content = REPLACE(post_content, ' style="color: #'[000000-999999]+';"', '')

but MySQL swears at the syntax, which is not surprising, I am not familiar with it, unfortunately

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladlen Grachev, 2014-07-16
@Semen55338

Regular expressions are not supported in REPLACE. It is recommended to use this package , but I do not think that this option will suit you. Try to change not on the side of the database, but with some script, for example. Consider two points:
1. Do not forget about the backup.
2. Regular color for RGB: #?([a-f0-9]{6}|[a-f0-9]{3}) .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question