Re: Variables in replace regex

2005-08-23 Thread Jay Savage
On 8/23/05, Jurgens du Toit <[EMAIL PROTECTED]> wrote: > Hey all... > > I want to use groupings, (TEST), and replacement > variables, $1, $2, etc, in a replacement regex, but > the replacement is built into a variable. Like so: > > #!/usr/bin/perl > > my $replace = "urgent \$1"; > my $string = "

Re: Variables in replace regex

2005-08-23 Thread Peter Scott
On Tue, 23 Aug 2005 06:30:07 -0700, I wrote: > > $string = s/(TEST)/qq("$replace")/giee; I mean =~ of course. Wups. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Variables in replace regex

2005-08-23 Thread Peter Scott
On Tue, 23 Aug 2005 14:02:03 +0100, Jurgens du Toit wrote: > I want to use groupings, (TEST), and replacement > variables, $1, $2, etc, in a replacement regex, but > the replacement is built into a variable. Like so: > > #!/usr/bin/perl > > my $replace = "urgent \$1"; > my $string = "This is a TE

Variables in replace regex

2005-08-23 Thread Jurgens du Toit
Hey all... I want to use groupings, (TEST), and replacement variables, $1, $2, etc, in a replacement regex, but the replacement is built into a variable. Like so: #!/usr/bin/perl my $replace = "urgent \$1"; my $string = "This is a TEST"; $string = s/(TEST)/$replace/gi; print $string; It outputs