Loading ...
Sorry, an error occurred while loading the content.

Re: Regexp question

Expand Messages
  • hooyar66
    ... pair. ... #!c:/perl/bin/perl.exe -w use strict; use diagnostics; my $line = hello {{ text {{innerbrace}} some text {{innerbrace2}} some text }} world ;
    Message 1 of 4 , Apr 1, 2007
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com,
      "jonnybongas2" <jonnybongas2@...> wrote:
      >
      > 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?
      >
      > $test = "hello
      > {{ text
      > {{innerbrace}}
      > some text
      > {{innerbrace2}}
      > some text
      > }} world";
      >
      >
      > //John
      >


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

      use strict;
      use diagnostics;

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

      print "\$line was: $line\n\n";

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

      print "\$line now: $line\n";
    Your message has been successfully submitted and would be delivered to recipients shortly.