Re: extract variables from expression
- From: "Matt Garrish" <matthew.garrish@xxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 08:57:40 -0400
<alexjaquet@xxxxxxxxx> wrote in message
news:1146314371.196741.78670@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
Does somebody know how to extract some variables from this expression :
[quote=alexandre]Ceci est un testttttt[/quote]
I want to extract the values alexandre and the text "Ceci est un test"
and I can have multiple quoted expression :
[quote=alexandre]Ceci est un testttttt[/quote]
[quote=tester]response[/quote]
Assuming no nested quotes and the data is always as simple as the above:
while (my $line = <DATA>) {
if ($line =~ m#\[([^\]]+)](.*?)\[/quote]#) {
my $speaker = (split(/=/, $1))[1];
my $quote = $2;
}
}
__DATA__
[quote=alexandre]Ceci est un testttttt[/quote]
[quote=tester]response[/quote]
.
- Follow-Ups:
- Re: extract variables from expression
- From: Matt Garrish
- Re: extract variables from expression
- References:
- extract variables from expression
- From: alexjaquet
- extract variables from expression
- Prev by Date: extract variables from expression
- Next by Date: share a session between two website
- Previous by thread: extract variables from expression
- Next by thread: Re: extract variables from expression
- Index(es):
Relevant Pages
|