in reply to looking for a regex
Assuming that the {} aren't nested.
$s ='25 {fred and barney} text 2.36 12.0 {bam bam} text {pebbles}'; $s =~ s[(\{.*?\})]{ local $_=$1; tr[ ][_]; $_}ge; print $s; 25 {fred_and_barney} text 2.36 12.0 {bam_bam} text {pebbles}
You'll have to explain what you mean by substitute a variable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: looking for a regex
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 |