Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > strange filenames pattern match

Reply
Thread Tools

strange filenames pattern match

 
 
Alythh
Guest
Posts: n/a
 
      01-27-2004
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
 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      01-27-2004
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
:@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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
finding an exact match of filenames jimgardener Python 1 10-16-2010 08:53 AM
How do you match 25 filenames? rnhurt@gmail.com Perl Misc 6 05-18-2005 12:10 AM
problem with filenames, Filenames and FILENAMES B.J. HTML 4 04-23-2005 08:13 PM
$match = true() for empty $match?? Victor XML 2 05-17-2004 10:43 AM
Java regex can't match lengthy match? hiwa Java 0 01-29-2004 10:09 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57