TheFunkeyGibbon Posted March 15, 2006 Share Posted March 15, 2006 I have a set of infomation in the following format. This is an example - the data might not always be in this exact orfder and there may be more or less infro in this memo field.pMADate={25/04/2005}pSBDate={25/04/2005}pexchfcst={31/05/2005}bPhone='m: 555 55555;'bsAttn=1pCompDate={28/10/2005}What I need to do is be able to pull that info into a var (say $blah) and then trim the info either side of a partiular pattern such as 'pSBDate={%/%/%}' so that all that I end up with a var with only that bit of data in it.I'm not sure if this is totally clear but if you think you can help please let me know and I'll try and clarify any points that are not well explained.Thanks for any and all help! Quote Link to comment https://forums.phpfreaks.com/topic/5032-using-ltrim-and-rtrim-to-get-a-specifc-string/ Share on other sites More sharing options...
k.soule Posted March 15, 2006 Share Posted March 15, 2006 trim is a function to remove whitespace from the beginning and/or ends of a string, it seems like you just want to have a string with all that info in it and be able to pull any of the data out of it at a given time, why not use an array? Unless I'm misunderstanding you.If it must be a string though, you can probably use preg_replace to return only the string you want. Quote Link to comment https://forums.phpfreaks.com/topic/5032-using-ltrim-and-rtrim-to-get-a-specifc-string/#findComment-17790 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.