ChOas has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my $Prep_Re=join '|',('VAN DER','VAN DE','DEN','DE','VAN'); print "Name\t\tPrependition\t\tWhatever\n"; while (<DATA>) { chomp; s/\s{2,}/ /g; my ($Name,$Prep,$Unknown); ($Name,$Prep,$Unknown)=($`,$1,$') if (/ ($Prep_Re)/); ($Name,$Unknown)=($`,$1) if ((!$Name)&&(/ (\S*?$)/)); $Prep||=''; print "$Name\t\t$Prep\t\t$Unknown\n"; }; __DATA__ WINTER DE <A240> ZANDEN VAN DER ŤAť JENSEN 230 WOODHEAD <D> BRINK 130,- HEYDIER DEN <240> SMITSER (4X115PJ) LINDEN VAN DER MOTEL GOLDEN LEEUW <A225>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can this be parsed ?
by dws (Chancellor) on Jul 11, 2002 at 06:23 UTC | |
by ChOas (Curate) on Jul 11, 2002 at 07:31 UTC | |
Re: Can this be parsed ?
by ChOas (Curate) on Jul 11, 2002 at 06:55 UTC | |
by hossman (Prior) on Jul 11, 2002 at 08:11 UTC | |
Re: Can this be parsed ?
by cLive ;-) (Prior) on Jul 11, 2002 at 08:05 UTC | |
Re: Can this be parsed ?
by Abigail-II (Bishop) on Jul 11, 2002 at 09:47 UTC | |
Re: Can this be parsed ?
by Popcorn Dave (Abbot) on Jul 11, 2002 at 18:45 UTC | |
Re: Can this be parsed ?
by hossman (Prior) on Jul 11, 2002 at 06:24 UTC | |
by Cody Pendant (Prior) on Jul 11, 2002 at 06:43 UTC | |
by hossman (Prior) on Jul 11, 2002 at 08:02 UTC |