I have the following short code I want to use to automatically generate Amazon Affiliate links in my posts [amazon region=com asin=xxxxxx].
How can I get the 'region' a and 'asin' from this string and convert every occurrence of it into my php function getAffiliateLink("com","xxxxxxxx")?
I can have multiple of these strings with different numbers on the page.
I have been looking into preg_replace and regex but I can't figure out how to do this for this particular example.
getAffiliateLink($region,$asin)orgetAffiliateLink('com','xxxxxx')?[amazon region=com asin=1234567]then I want this to be replaced in my code withgetAffiliateLink("com","1234567"). There can be more links like these in one post with different asin numbers. ( I edited my question to make it more clear)regionandasinalways in the same order? or it can be different?