![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
Re: looking simple regexp for arff file formatby l.frankline (Hermit) |
on Nov 29, 2005 at 07:29 UTC ( #512538=note: print w/replies, xml ) | Need Help?? |
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 Don't put off till tomorrow, what you can do today.
In Section
Seekers of Perl Wisdom
|
|