Hi all -
I hope I have used the correct words in the title. I cannot figure out how to accomplish the following:
As I run through the results of my sql statement one result is a string called $restrictions. This string is somewhat different for each row of the results.
Example $restrictions string for 3 different rows:
Row 1
Canada only, except Quebec. 18+
Row 2
US(50+DC)/Canada, age of majority.
Row 3
Canada, except Quebec. Age of majority.
and so on.
What I want to achieve is the replacement of certain parts of the string with new wording.
Example (where 1st line is the current result for $restrictions and 2nd line is the required result)
Row 1
Canada only, except Quebec. 18+
Canada only, no QC, 18+
Row 2
US(50+DC)/Canada, age of majority.
US(50+DC)/Canada, AoM.
Row 3
Canada, except Quebec. Age of majority.
Canada, no QC. AoM
I've tried using explode(), str_replace() and both but I can't get the desired results. Since the $restrictions string varies quite a lot with varied upper case and lower case, punctuation, spacing and wording, I'm lost as how to parse it properly.
Any thoughts?
Kind regards
Bob