List Info

Thread: Re: Regexp question




Re: Regexp question
country flaguser name
United States
1969-12-31 18:00:00

--- In perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com,
"jonnybongas2" <jonnybongas2...> wrote:
&gt;
> I have a variable like the one below. It contains nested braces
pair.
> I'd like to create a regexp that changes the variable value to the
> string "hello world";. Can anyone help with me this?
&gt;
> $test = "hello
> {{ text
>; {{innerbrace}}
>; some text
>; {{innerbrace2}}
&gt; some text
>; }} world";;
>
>
> //John
&gt;

#!c:/perl/bin/perl.exe -w

use strict;
use diagnostics;

my $line = "hello
{{ text
{{innerbrace}}
some text
{{innerbrace2}}
some text
}} world";;

print "$line was: $linenn&quot;;

$line =~ s/n//g;
$line =~ s/{{.+}}//;

print "$line now: $linen&quot;;

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )