php - Regex running all matches together instead of returning separate -
I am working on a php script for a custom CMS that will replace a custom tag with information from the database .
will be a tag like
I have to remove the ID, suffix, and prefix specifications. In the code below, there is only one example on this tag, but if I have more than one, or if "->" is somewhere else on the page, then it is not working properly. It matches everything between the first
"
and the last
" - & gt; "
Instead of returning each match separately.
Here is my current code if it is working properly, then this whole tag will have the value of" id " Finally, this will be data from database.
$ value as $ $) {if ($ key == 0) {$ lastNav if $ ($ value == 'id') {$ lastNav ['id'] = $ NavData [$ key + 1];} If '' $ '' = '& lt; $ Value. ' & Gt; {$ Value == 'suffix'} {$ lastNav ['suffix'] = $ navData [$ value == 'prefix' $ Key + 1];}} $ html = str_replace ($ lastNav ['replace'], $ lastNav ['id'], $ html);} $ html echo ;? & Gt;
At this point I am not concerned about sensory sensitivity. There is a chance that attributes can have special characters, including single or double quotes.
Hopefully I have explained this well. thank you in advanced. P>
Jonathan Kuhn worked the solution for the time I went with the first approach to fix the existing regex .
/
Later I'll modify it to break it down to work in some form, function. I appreciate the help.
Comments
Post a Comment