I have preg_matches running. It works as follows:
- Search for starting tag
- Search for ending tag
This works; however, the page that I get data back from sometimes does not have data for that tag field. So instead of what should be a normal
<Field1>Data Here</Field1>
shows up as
<Field/>
So as you can see above, if there is no data (rather than not show the tag) it puts one ending tag and changes the tag itself too. Unfortunately, I need to enter "NA" for that data which may or may not be present.
(Note the <Field/> Not </Field>.
I'm curious to any thoughts you might have on being able to accomplish a workaround.
* Search for <field></field>
* Also search for ></field>
* Replace ></field> with <field></field> to match it all up.
Here is what I am using currently:
if(preg_match_all('@<(TicketNbr|Summary|Resolution|Site_Name|date_entered|status_description
|ServiceType)>\\s*(.*?)\\s*</\\1>@is', $resp, $m) ) {
so I figured I could go right into possibly a preg_realace which I believe will work like match_all just replacing them.
Will a preg_replace work against the above preg_match_all or if I could just tie in a
><field/>
into the preg_match_all.