Thread Wieder eine lustige RegEx (9 answers)
Opened by pktm at 2008-04-22 22:09

Gast Gast
 2008-04-29 06:47
#108966 #108966
Code (perl): (dl )
1
2
my ($word, $pos, $attrs) = $line =~ /^(\w+)\s+\[(\w+)\s+(.*)\]/;
my %attrs = map m/(\w+)=(\w+)/, split /\s+/, $attrs;

geht auch einfacher:
Code (perl): (dl )
1
2
my ($word, $pos, $attrs) = $line =~ /^(\w+)\s+\[(\w+)\s+(.*)\]/;
my %attrs = split /\s+|=/, $attrs;

View full thread Wieder eine lustige RegEx