Thread Probleme mit RegEx und Worttypen (49 answers)
Opened by Dingels at 2008-07-25 19:00

LanX-
 2008-07-25 19:15
#112726 #112726
User since
2008-07-15
1000 Artikel
BenutzerIn

user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use strict;
use warnings;
use Data::Dumper;


my %hash = ('Abend' => 'NN',
            'Sonne' => 'NN',
            'Haus' => 'NN',
                );
my $text="Haus Abendsonne haussonne hurz";

my $words_re= join '|', keys %hash;
my @komposita= $text =~ m/\b(?:$words_re)(?:$words_re)\b/gi;

print Dumper \@komposita;


$VAR1 = [
'Abendsonne',
'haussonne'
];

View full thread Probleme mit RegEx und Worttypen