sliles has asked for the wisdom of the Perl Monks concerning the following question:
I want to delete some of the left curly braces (but not all) and change the last closing brace } to an "END;" so that the modified text looks like:select (name) { //want to delete this { brace case(a=b): { // delete this { brace if (d=e) { // keep this { brace for if loop call pgmA; return rc; } // keep this } brace for if loop } // delete this } brace default: { // delete this { brace call pgmB; } // delete this } brace } // change the last } brace to END;
Can anyone suggest a solution? I know how to search for patterns, but I cannot figure out how to change the occurrence of some characters but not to change other occurrences of it. Thanks for your time, Susanselect (name) case(a=b): if (d=e) { ----->keep this opening brace in call pgmA; if loop return rc; } ----->keep this closing brace default: call pgmB; END; ----->change last } to END;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: parsing question
by mstone (Deacon) on Jan 08, 2002 at 01:14 UTC | |
by tilly (Archbishop) on Jan 08, 2002 at 02:26 UTC | |
by mstone (Deacon) on Jan 08, 2002 at 05:43 UTC | |
by tilly (Archbishop) on Jan 08, 2002 at 06:23 UTC | |
by MeowChow (Vicar) on Jan 08, 2002 at 06:02 UTC | |
by mstone (Deacon) on Jan 09, 2002 at 01:04 UTC | |
by mstone (Deacon) on Jan 09, 2002 at 00:20 UTC | |
|
Re(2): parsing question
by dmmiller2k (Chaplain) on Jan 08, 2002 at 01:02 UTC | |
|
Use Parse::RecDescent
by johanvdb (Beadle) on Jan 08, 2002 at 15:36 UTC | |
|
Re: Re: parsing question
by thunders (Priest) on Jan 08, 2002 at 05:38 UTC | |
by FoxtrotUniform (Prior) on Jan 08, 2002 at 21:46 UTC |