MySQL 模式匹配和替换

标签 mysql pattern-matching

我有一个带有设置列的表,在三个不同的行中包含以下数据:

{{product.description}}

{{user.email}}

{{last_date}}

我想附加字符串“|” format'与动态数据,输出应该是这样的

{{product.description | format}}

{{user.email | format}}

{{last_date | format}}

我尝试使用 MySQL REPLACE()方法,但问题是如何匹配这个指定的模式。

对此的更新查询是什么?

最佳答案

you can use the REGEXP operator as follows:
SELECT (statement) REGEXP '{product.description}[.space.]|[.space.]format';

希望有帮助。

关于MySQL 模式匹配和替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28359393/

相关文章:

mysql - 如何将SQL查询转换成MYSQL查询?

php - 需要查询或交易将数据导出为设定格式

Haskell GHC : what is the time complexity of a pattern match with N constructors?

c# - 使用模式匹配来匹配具有非零下限的数组

mysql - 如何删除重复的mysql行但保持最大 View

c++ - mysql_stmt_store_result() 上的 MySQL C API 崩溃

php - 从带有缩略图或介绍图片的 wordpress 数据库中选择帖子

scala - 与类型删除类型匹配的部分函数

batch-file - 用于删除目录中具有唯一根茎的文件的批处理脚本

c++ - 匹配线段 - 稳健且快速的方式