What is the MySQL query equivalent of PHP strip_tags?

后端 未结 9 773
情书的邮戳
情书的邮戳 2020-11-27 18:49

I have a large database which contains records that have tags in them and I would like to remove them. Of course there is the method where I create a

9条回答
  •  無奈伤痛
    2020-11-27 19:21

    REPLACE() works pretty well.

    The subtle approach:

     REPLACE(REPLACE(node.body,'

    ',''),'

    ','') as `post_content`

    ...and the not so subtle: (Converting strings into slugs)

     LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(node.title), ':', ''), 'é', 'e'), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), '–', ''), ' ', '-'), '--', '-'), '--', '-'), '’', '')) as `post_name`
    

提交回复
热议问题