MySQL query with variable data

I have searched through various MySQL queries with wildcards, and replace calls, but I can’t find exactly what I am looking for.

I need to update shortcodes for an entire site due to a upgrade in the Amazon Product in a Post Plugin. This string replace call must handle a variable string:

Inside a WordPress database for a mom blog:

I must replace

[AMAZONPRODUCT=B0084IG8TM]

with

[amazon-element asin="B0084IG8TM" fields="title,sm-image,new-price,button"]

So the call must identify the base string, and then identify the 10 character product code WHICH IS VARIABLE, and wrap content around that 10 character string inside the square brackets.

Suggestions?
Thank You Very Much.


Source: shortcode

Leave a Reply