WorldDrknss Posted July 3, 2007 Share Posted July 3, 2007 I need help matching a string similar to what is bellow: |$INFO Some information$Some information$Some information$Some information$Some information$Some information$Some information$Some information$| I have tried: $parts = eregi("\|\$HubINFO [(.*)\$]{8}\|", $out, $matches); but obviously this does not work. Quote Link to comment Share on other sites More sharing options...
rea|and Posted July 3, 2007 Share Posted July 3, 2007 Well, do you need to match only one line or many? anyways, to match one single line try this: $myString='|$INFO Some information01$Some information02$Some information03$Some information04$Some information05$Some information06$Some information07$Some information08$|'; $myString=preg_split('/\|\$INFO\s*|\$|\|/',$myString,-1,PREG_SPLIT_NO_EMPTY); echo '<pre>'.print_r($myString,true).'</pre>'; Quote Link to comment Share on other sites More sharing options...
WorldDrknss Posted July 4, 2007 Author Share Posted July 4, 2007 It will be multilines, and I need it broken down by Some information$ so I can pull each of its data Quote Link to comment Share on other sites More sharing options...
WorldDrknss Posted July 4, 2007 Author Share Posted July 4, 2007 I figured it out thanks for your help. Quote Link to comment Share on other sites More sharing options...
effigy Posted July 5, 2007 Share Posted July 5, 2007 Please post your solution so that (1) others can learn, and (2) we can double check your work What works may not necessarily be correct, especially with regex. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.