strange filenames pattern match

Discussion in 'Perl Misc' started by Alythh, Jan 27, 2004.

  1. Alythh

    Alythh Guest

    I have the beginning of a filename, say $songname,
    and I have to pattern-match it with the complete filename, from a list
    @allfiles taken from a directory.

    Doing
    foreach( @allfiles )
    {
    if ( /$songname/ )
    { $truename = $_ }
    }

    should work, only problem is filenames often include chars as (), etc
    and I got a runtime error:

    Unmatched ( before HERE mark in regex m/God Within Featuring Scott Har
    - The Phoenix ( << HERE Ritm.mp3/ at
    /0ale/excursions/digital/script/stream_smart.pl line 68.


    <background>
    it should work as wrapper to streamripper, to erase .mp3s saved but
    incomplete, due to mpglib errors. If you used streamripper you'll know
    what I mean.
    Filename like that often seem like:
    God Within Featuring Scott Har - The Phoenix (Ritm's River.mp3
    </background>


    Thanks for any help...

    Alessandro Magni
     
    Alythh, Jan 27, 2004
    #1
    1. Advertising

  2. In article <>,
    Alythh <> wrote:
    :I have the beginning of a filename, say $songname,
    :and I have to pattern-match it with the complete filename, from a list
    :mad:allfiles taken from a directory.

    :should work, only problem is filenames often include chars as (), etc

    /\Q$songname\E/
    --
    The Knights Of The Lambda Calculus aren't dead --this is their normal form!
     
    Walter Roberson, Jan 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hiwa
    Replies:
    0
    Views:
    640
  2. B.J.
    Replies:
    4
    Views:
    744
    Toby Inkster
    Apr 23, 2005
  3. Victor
    Replies:
    2
    Views:
    649
    Victor
    May 17, 2004
  4. jimgardener

    finding an exact match of filenames

    jimgardener, Oct 16, 2010, in forum: Python
    Replies:
    1
    Views:
    277
    Peter Otten
    Oct 16, 2010
  5. Replies:
    6
    Views:
    131
    A. Sinan Unur
    May 18, 2005
Loading...

Share This Page