in reply to regex question

I can't golf before my morning coffee... But it works.
my $line = qq(01 02 1 | Ozzy Osbourne | + Back On Earth Ozzy Osbourne - Back on earth.mp3 | 5: +00 4689 44.100 128); my @pieces = split /\s*\|\s*/, $line; my $file = $1 if $pieces[2] =~ /\s\s(.*?\.mp3)/; print "$file\n";

Replies are listed 'Best First'.
(jeffa) 2Re: regex question
by jeffa (Bishop) on Nov 16, 2001 at 20:09 UTC
    Once everyone reminded me about escaping pipes ...
    my $file = (split(/\s*\|\s*/,$line))[2];
    But your way is safer. ;)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    F--F--F--F--F--F--F--F--
    (the triplet paradiddle)