I have the following string which I need to be bale to extract the parameters from in order to process the next part of the code. I have manage to do this by doing multiple preg_match_all, but it is not very efficient and/or dynamic.
Example strings (the source might contain multiples): <==OBJECTSTART==>type=>sqltable,objectid=>4000001,options=>1|5|2<==OBJECTEND==>
<==OBJECTSTART==>type=>sqltable,objectid=>4000002,options=>3|8|5<==OBJECTEND==>
What I have so far I have go to the following for a regex expression:
/<==OBJECTSTART==>((.?),)(.?)<==OBJECTEND==>/
This gives me the information before the first comma but I have tried the usual + and * to give me a repeat iteration but no luck.
ideally I am looking for an array of objects that looks like the following
[0]=>
[type]=sqltable
[objected]=4000001
[options]=1|5|2
[1]=>
[type]=sqltable
[objected]=4000002
[options]=3|8|5
thanks in advance!
/([^,=>]+)=>([^,<=>]+)/gappears to match the keys and corresponding values correctly. If you use it one line at a time, you should be able to build up your array.