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.