Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: parsing print_r() output with preg_match_all() Date: Tue, 12 Jan 2016 22:29:24 +0100 Lines: 75 Message-ID: <56957034.90807@arnowelzel.de> References: <568d3dcf$0$23748$e4fe514c@news.xs4all.nl> <87r3huzevd.fsf@bsb.me.uk> <568d6f9c$0$23759$e4fe514c@news.xs4all.nl> <569363A3.6040108@arnowelzel.de> <5694313D.3060100@arnowelzel.de> <56948447.9030208@arnowelzel.de> <569565BA.2020802@arnowelzel.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit X-Trace: individual.net jfYr5wWOdrbc3OEiq2BR4wlYbh1zabnG1wvy4uMsa5so3BDdsD Cancel-Lock: sha1:5uUiB1J5ZT8zIhid6D+rIaGs0jg= In-Reply-To: Xref: csiph.com comp.lang.php:16229 Jerry Stuckle schrieb am 2016-01-12 um 22:13: > On 1/12/2016 3:44 PM, Arno Welzel wrote: >> Jerry Stuckle schrieb am 2016-01-12 um 15:13: >> >>> On 1/11/2016 11:42 PM, Arno Welzel wrote: >>>> Jerry Stuckle schrieb am 2016-01-12 um 02:50: >>>> >>>>> On 1/11/2016 5:48 PM, Arno Welzel wrote: >>>>>> Jerry Stuckle schrieb am 2016-01-11 um 14:04: >>>>>>> On 1/11/2016 3:11 AM, Arno Welzel wrote: >>>>>>>> R.Wieser schrieb am 2016-01-06 um 20:50: >>>>>>>> >>>>>>>>> Ben, >>>>>>>>> >>>>>>>>>> It would be a lot simpler if you could switch to using >>>>>>>>>> serialize and unserialize. Do you need to use print_r >>>>>>>>>> for some other reason? >>>>>>>>> >>>>>>>>> I'm using it to store the array-of-arrays into a file in human-readable >>>>>>>>> format. I intend to parse this file using another program, posibly alter >>>>>>>>> some info and write it back. >>>>>>>>> >>>>>>>>> And thats the point where I wanted to use that regex to read the structure >>>>>>>>> back in. >>>>>>>>> >>>>>>>>> Now you mention it, I've heard from serializing and unserializing, but >>>>>>>>> was/am assuming that its not really ment to be read/understood by humans. >>>>>>>>> >>>>>>>>> But what's the problem with using that preg_match_all() ? >>>>>>>> >>>>>>>> It's prone to errors to build a parser on your own and there are already >>>>>>>> working and tested(!) solutions. >>>>>>>> >>>>>>>> May JSON is a good alternative for you: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> JSON is still "human readable" but also a defined format and there are >>>>>>>> parsers for other programming languages as well. >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> Gee, who built the parsers we have? Machines? ROFLMAO! >>>>>> >>>>>> No - but there are *standards* you can refer to which are usually way >>>>>> better then trying to invent the wheel over and over again. >>>>>> >>>>> >>>>> You wouldn't know. You have no idea what standards are. >>>> >>>> What you call ECMA then? An organization of trolls? >>>> >>>> >>> >>> I know what ECMA is. But you have no idea what standards are, troll. >> >> >> You did it again. QED. >> > > Trying to put words in my mouth again I see, troll. It doesn't work - > it just makes you look even more stoopid. You did it again. QED. Oh - and you will repeat this many, many times and will never believe that your behaviour is inappropriate. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de