我想更改wordpress wp_posts表上的简码。在post_contents字段上,我有一些带有一些短代码的html代码,如下所示:

[PFltr "this text is variable, changes on each occurrence"]


我想为此:

[scode option="1"]this text is variable changes on each occurrence[/scode]


是否有任何mysql更新查询(也许使用正则表达式)来执行此操作?

最佳答案

由于此标签分别标记为regexreplace,因此您可以使用

/\[PFltr\s"([^"]+)"]/并替换为[scode option="1"]$1[/scode]

DEMO

10-06 00:46