Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: looking simple regexp for arff file format

by l.frankline (Hermit)
on Nov 29, 2005 at 07:29 UTC ( #512538=note: print w/replies, xml ) Need Help??


in reply to looking simple regexp for arff file format

Hi,

I have made a small change.. it works..

my @lines = (
    "@attribute 'Sex' { Male, Female}",
    "@attribute 'Feature 0' real",
    "@attribute 'Feature 1' real",
    "@attribute 'Feature 2' real",
    "@attribute Malic_acid REAL",
    "@attribute Ash REAL"
    );
foreach my $line (@lines) {
    $line =~ /^@attribute\s+([']?(?:[^\']*)[']?)\s+[{]?(.*?)[}]?$/;
    print "relation name: $1\n";
    print "type: $2\n";
}

Regards
Franklin

Don't put off till tomorrow, what you can do today.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://512538]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2019-12-16 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?