I need help creating a regex for my php script. Basically, I have an associative array containing my data, and I want to use preg_replace to replace some place owners with real data. The input will be something like this:
<td>{{address}}</td><td>{{fixDate}}</td><td>{{measureDate}}</td><td>{{builder}}</td>
I do not want to use str_replace because the array can contain much more elements than I need.
If I understand correctly, preg_replace can take the text that it finds from the regular expression and replace it with the value of this key in the array, for example.
<td>{{address}}</td>
replace with the value $ replace ['address']. Is this true, or am I reading php documents incorrectly?
If this is true, can someone please help show me a regular expression that will analyze this for me (it would be appreciated if you also explained how this works, as long as I am not very good with regular expressions).
Thank you very much.
source share