Perl Regex Output only characters that can be used as unix filename

Posted by Jeff Balinsky on Stack Overflow See other posts from Stack Overflow or by Jeff Balinsky
Published on 2010-12-26T02:19:25Z Indexed on 2010/12/26 2:54 UTC
Read the original article Hit count: 280

Filed under:
|
|

I wrote a basic mp3 organizing script for myself.

I know the power of regex but I suck with the syntax

I have the line $outname = "/home/jebsky/safehouse/music/mp3/" . $inital . "/" . $artist . "/" . $year ." - ". $album . "/" . $track ." - ". $artist ." - ". $title . ".mp3";

All I want is a regex to change $outname so that any non safe for filename characters get replaced by an underscore

Thanks Jeff

© Stack Overflow or respective owner

Related posts about regex

Related posts about perl