Okay, so I'm anal about the way my music files are named on my hard drive. I like to have my music files named in a specific format, so after downloading a ton of music, I have a lot of renaming to do.
I thought to myself, why not once again use perl to your advantage. Here's what I'm looking for: I download files with all sorts of naming conventions and I'm looking to rename them to this format:
Music Author - Song of Title
I started thinking of a regular expression that could do this and then realized all the possible cases to take of. Capitalization, removing certain elements, adding spaces where needbe, etc. I'm not the most experienced programmer when it comes to regular expressions, but from my minimal use, I think this could be done. Any help monks?
What regular expression would I need (or series of regular expressions) to rename a file like below? Or is this too broad of a task, with too many possibilities to do with reg. exps.?
xecutioners-you_cant_scratch_(skit)
to
Xecutioners - You Cant Scratch Skit
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.