![]() |
multiline regex
Hi,
I would like to convert this block of text: (app "webserver" (ip "1.2.3.4") (name "foo") (host "somehost") ) to this: app.webserver.ip="1.2.3.4"; app.webserver.name="foo"; app.webserver.host="somehost"; and skip processing of the entire block if the top level contains a "no", for example: (some_condition "no" (foo "") (bar "") ) Is there already some method of doing this in perl, or is this a regex job? Any advice? Thanks, Mike |
Re: multiline regex
Mike Jackson <mjj@isorauta.ntc.nokia.com> wrote in comp.lang.perl.misc:
> Hi, > I would like to convert this block of text: > > (app "webserver" > (ip "1.2.3.4") > (name "foo") > (host "somehost") > ) > > > to this: > > app.webserver.ip="1.2.3.4"; > app.webserver.name="foo"; > app.webserver.host="somehost"; > > > and skip processing of the entire block if the top level contains a > "no", for example: > > (some_condition "no" > (foo "") > (bar "") > ) > > > Is there already some method of doing this in perl, or is this a regex > job? Any advice? What have you tried so far? We help writing scripts, but we're not in the business of delivering to specification. You have nested parentheses to parse, so Text::Balanced will probably figure in the solution. Anno |
Re: multiline regex
Anno Siegel wrote:
> > You have nested parentheses to parse, so Text::Balanced will probably > figure in the solution. Hi, That was all I asked and all I wanted to know, e.g. was there already a module that could assist in this task, or was it purely a regex task. Thanks for the tip :-) I'm sure that it will save me some time. Thanks, -- mike |
| All times are GMT. The time now is 09:35 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.