Title: RE: regex / a simple question
THANX TO EVERYONE HELPED ME !!!!
-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von Andre Andreev
Gesendet: Donnerstag, 22. Februar 2001 20:59
An: [EMAIL PROTECTED]
Betreff: RE: regex / a simple question



Hello,
thanks Jenda!

$string = "1<2<3,4<5,6,7[+1,1,1]>[+1,1]><8,9[+1,2]>[+1]>[+]";

I've tried your
$string =~ s/\[\+(.*?)\]//;

Result:
             1<2<3,4<5,6,7>[+1,1]><8,9[+1,2]>[+1]>[+]

Then I've tried your:
$string =~ s/\[\+([\]]*)\]//;

Result:
             1<2<3,4<5,6,7[+1,1,1]>[+1,1]><8,9[+1,2]>[+1]>
Finally, I've tried your version with some changes:
$string =~ s/\[\+(.*?)\]//g;

Result:
             1<2<3,4<5,6,7>><8,9>>

Is that what Kristofer needed?

Thank you!

> -----Original Message-----
> From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 22, 2001 1:24 PM
> To: [EMAIL PROTECTED]
> Subject: Re: regex / a simple question
>
>
> > hi all,
> >
> > can anyone please help me ???
> >
> > if got a string:
> > "1<1<1,1<1,1,1[+1,1,1]>[+1,1]><1,2[+1,2]>[+1]>[+]"
> >
> > and want to remove all "[...]" things, using a wrong regex,
> because mine
> > starts by the first [ and ends by the last "]" to remove.
> > :
> > <1<1,1<1,1,1
> >
> > I using:
> >
> > $p =~ s/\[\+(.*)\]//;
>
> Either
>
>  $p =~ s/\[\+(.*?)\]//;
>    # The ? makes the * not greedy, that is it matches as few
>    # characters as possible, not as much
>
> or
>
>  $p =~ s/\[\+([\]]*)\]//; # [^\]] matches anything but ]
>
> HTH, Jenda

>
> == [EMAIL PROTECTED] == http://Jenda.McCann.cz ==
> 28th of March I'll march out of the "army"
> I'll be free so if you want me ...
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
>

Reply via email to