Re: extract variables from expression
- From: alexjaquet@xxxxxxxxx
- Date: 29 Apr 2006 06:56:44 -0700
I made another test :
#!/usr/bin/perl -w
use strict;
my $line = " [quote=alexandre]Ceci est un
testttttt[/quote][quote=tester]response[/quote]";
open(DATA,">filename.txt");
print DATA $line;
close DATA;
open(DATA,"<filename.txt");
while ($line = <DATA>) {
if ($line =~ m#\[([^\]]+)](.*?)\[/quote]#) {
my $speaker = (split(/=/, $1))[1];
my $quote = $2;
print "$speaker\n";
}
}
close DATA;
and it's only print the first speaker
.
- Follow-Ups:
- Re: extract variables from expression
- From: Matt Garrish
- Re: extract variables from expression
- References:
- extract variables from expression
- From: alexjaquet
- Re: extract variables from expression
- From: Matt Garrish
- extract variables from expression
- Prev by Date: Re: extract variables from expression
- Next by Date: Re: Redirecting STDOUT to a file
- Previous by thread: Re: extract variables from expression
- Next by thread: Re: extract variables from expression
- Index(es):