You will likely need to handle each string from the database separately. I would suggest creating a function which takes the source string, starting and ending delimiters, target string, and a flag which indicates whether you want to convert just the first or all instances. I suggest building a module and placing this code in a module. This promotes code reuse (you can then insert the module into future programs and you have these subroutines and functions already coded).

To find and replace the target string you can use two different approaches. The first is to use the string function IndexOf to find the first instance of the start delimiter, and then the first instance of the end delimiter after that point. Extract the text with a Substring command and compare with the target string. Alternatively, use the string Split command, splitting on the start delimiter. Note this is a destructive process - the start delimiter is thrown away in this process. It has the benefit of breaking up the source string into an array with each element starting with the text between the delimiters. You still need to check for the end delimiter to figure out the value of the bounded text. Compare this with the target string and replace the text as necessary. Using the split approach you need to reconstitute the final modified string by concatenating the array elements together again.