Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am a novice seeking wisdom.
I have a string which looks like:
what I need is a regex that transforms all the spaces within the curly brackets to underscores. e.g the result should be:25 {fred and barney} text 2.36 12.0 {bam bam} text {pebbles}
is there a simple way to do this?25 {fred_and_barney} text 2.36 12.0 {bam_bam} text {pebbles}
What would be even neater is if I could substitute the contents of the brackets with a variable. This must surely be possible!?
thanks for your help
20030422 Edit by Corion: Added formatting
novice Moritz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: looking for a regex
by BrowserUk (Patriarch) on Apr 22, 2003 at 09:40 UTC | |
by Anonymous Monk on Apr 22, 2003 at 10:25 UTC | |
by BrowserUk (Patriarch) on Apr 22, 2003 at 10:50 UTC | |
by demerphq (Chancellor) on Apr 22, 2003 at 15:25 UTC | |
by Anonymous Monk on Apr 22, 2003 at 15:20 UTC | |
|
Re: looking for a regex
by jmcnamara (Monsignor) on Apr 22, 2003 at 10:00 UTC | |
|
Re: looking for a regex
by broquaint (Abbot) on Apr 22, 2003 at 09:52 UTC | |
|
Re: looking for a regex
by perlguy (Deacon) on Apr 22, 2003 at 14:44 UTC |