On Fri, Jan 20, 2006 at 04:22:28PM +0100, Adriano Allora wrote:
From: Adriano Allora <[EMAIL PROTECTED]>
I've got this four rows (for instance):
araba ADJ arabo
arabo ADJ arabo
arabo NOM arabo
arano VER:pres arare
and, with this regular expression, I would extract only the fourth one:
my $form1 = qw(ara\w+);
my $pos1 = qw([A-Z]+);
my $lemma1 = qw(?!arabo);
my $pattern = "^(?:$form1)[^A-Z]*($pos1)[^A-Z]*($lemma1)\n";
but it doesn't work (the script extracts all the lines).
If I understand well your question this one can help you ?
#!/usr/bin/perl
# match1.pl
use warnings;
use strict;
my @col4;
while (<DATA>) {
if (/\w+ +\w+ +\w+ +(\w+)/ or /\w+ +\w+:\w+ +(\w+)/) {
push @col4, $1 if $1;
}
}
print "@col4\n";
__DATA__
araba ADJ arabo manolo
arabo ADJ arabo issan
arabo NOM arabo bonobo
arano VER:pres arare
--
Gérard
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>