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: Mon, 11 Jan 2016 23:48:29 +0100 Lines: 52 Message-ID: <5694313D.3060100@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> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit X-Trace: individual.net 7N6e1OZsCyvfkaPWXVSJtQZF5V383sReRTlvVa2pMYMcDjc1Ls Cancel-Lock: sha1:4vfDSiGdHoI1lmkk6smvqb+vBj0= In-Reply-To: Xref: csiph.com comp.lang.php:16184 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. > It's not easy - but not everyone is as incompetent as you are, Arno. In > fact, most people are much more competent. I know you have your problems with standards. You don't have to emphasize this all the time over and over again. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de