E
E
Evgeny Shevtsov2015-05-31 14:19:48
MySQL
Evgeny Shevtsov, 2015-05-31 14:19:48

How to find and delete part of a string in mysql?

There is a story column in the post table. The value of the rows in the column is text, and there are links inside.
And some of the links are broken.
For example, from this text:

<!--TBegin:https://xxxzzz.qq/uploads/posts/2015-03/1425316967_600_default.jpg|left--><a href="https://xxxzzz.qq/uploads/posts/2015-03/1425316967_600_default.jpg" onclick="return hs.expand(this)" ><img src="https://xxxzzz.qq/uploads/posts/2015-03/thumbs/1425316967_600_default.jpg" style="float:left;" alt='Южнокорейские компьютерные системы АЭС оператора были взломаны хакерами'

Remove links https://xxxzzz.qq/uploads/posts/2015-03/1425316967... ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mokhirjon Naimov, 2015-05-31
@zvermafia

You need to use a regular expression

M
Melkij, 2015-05-31
@melkij

update post set story = REPLACE(story,from_str,to_str) where /**/

https://dev.mysql.com/doc/refman/5.1/en/string-fun...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question