Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有一种简单的方法可以在 mysql 中执行以下操作:
"Value ( some stuff here) " --> "Value"
类似的东西REPLACE("(*)","")?我将如何去做这件事并去除剩余的空白?
REPLACE("(*)","")
尝试:
"/s*/(.*/)/s*"
这将匹配前导空格、括号中的文本和尾随空格。
查看 UDF(用户定义的函数)。你会想要像 oracle 的 REGEXP_REPLACE
在 mysql 中,您不能用正则表达式帮助替换行项。因此,您必须从定义的列中选择所有值“Value (some stuff here)”。使用 python 工具在客户端处理它们。之后,您需要更新 mysql 数据库中的所有行。
或者您可以阅读此答案How to do a regular expression replace in MySQL?