【问题标题】:How to replace more than one keyword in a string in MYSQL using REPLACE and regex [duplicate]如何使用REPLACE和正则表达式替换MYSQL中字符串中的多个关键字[重复]
【发布时间】:2015-03-03 20:20:07
【问题描述】:

我在 mysql 表中有一组字段值,例如

aaaworld
worldme
make
pull
pullme
aaatag
tagbbb
aaamousebbb

现在我想删除所有出现的 aaa 和 bbb 并用 "" 替换它们, 我尝试了以下表达式

SELECT REPLACE(keywordSupplied,"aaa|bbb","") FROM table1

这里只用 "" 替换 aaa 部分,而 bbb 部分保持原样。 如何替换两者的出现

【问题讨论】:

标签: mysql regex replace


【解决方案1】:

您可以使用“||”而不是“|”。它可能会起作用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-16
    • 1970-01-01
    • 2011-08-18
    • 2017-11-17
    • 1970-01-01
    • 2013-02-01
    相关资源
    最近更新 更多