Regular Expressions - Help

Discussion in 'Mac Programming' started by Cattywampus_, Nov 9, 2008.

  1. Cattywampus_ macrumors 6502a

    Apr 19, 2006
    Hi there

    I am having issues with Media Rage. I use the app to populate the ID3 tags with information from the file names of the MP3 files.

    I have no knowledge of regular expressions or anything like that - but I tried none the less to edit to do what I wanted but I couldn't get it to do what I wanted. I will explain my problem and hopefully you can provide me with the correct expression to use in your program to do what I want.

    My MP3 albums are named like this


    All the filenames have underscores instead of spaces. So a typical track would look like


    Now the expression built into the program which is 00-Artist-Album-Title works - I just changed the dashes for double underscores. Some of my albums though have remixes on them. So there is a further __ to seperate the mix name from the title of the track. Eg


    When using the expression for the 00-Artist-Album-Title filename won't work. It puts the data in the wrong files. After a bit of messing round I did manage to make an expression that would bind the last two instances together but it causes filenames without the last __ instance to fail.

    Do you know what string I would need to use so that it will work with both?

    Many thanks.
  2. Ti_Poussin macrumors regular


    May 6, 2005
    You seem quite near of your goal, just check for the occurrence for the last part, you should use {0,1} or ? if that is support by the utility you use, on the last part that trigger the last __ and part, so you don't have to bother with it and should be valid.

    I would like to help more, but not sure what you want to achieve with your regex?!? what execute the regex? perl, python, bash script...?
    specify the input/output format clearly.

    Anyway, here a good help to use regex:
  3. Cattywampus_ thread starter macrumors 6502a

    Apr 19, 2006
    Many thanks for your help. I wrote that post when I was stoned so its probably not the clearest of explanations! lol.

    I managed to sort it in the end - by emailing the developer of Media Rage :) He gaved me the correct expression to use. Worked a treat! :)

    Thanks again.

Share This Page