locked
An MP3 Tagging RegEx that's almost complete RRS feed

  • Question

  • Hi,

    I use a program called MP3Tag (http://www.mp3tag.de/en/ ) for my music library. I came across this regex that basically capitalizes acronyms in song titles, artist fields and album fields. For example, if a song's artist is "dj Pretzel", this regex should rename it to "DJ Pretzel".

    I didn't write this regex. My problem with it is that it only seems to capitalize acronyms like "DJ" if they AREN'T the first or last word in the field. I would like it to work no matter where the acronym is. I'm not really sure why the author wrote it the way it is, doesn't make much sense to me.

    Here's the regex. I'm not super great with regex, so I don't know how much of this is specific to the MP3Tag program. Hopefully not a lot so that somebody here can help me.

    Regular Expression:

    (?<=[^\w\']|\_)(dmx|ac|ad|afi|aol|asap|atm|bbc|bc|bce|blt|btw|cc|cia|cst|csv|dc|dj|dmv|dmx|doa|dst|eod|ep|est|et|faq|fbi|fm|gi|glc|gmo|imo|imho|iq|ira|jc|irs|krs|lp|mc|mst|mtd|mvp|nasa|oj|pc|pi|pj|pm|ps|qed|rv|sos|ssr|usa|ussr|tba|tbd|teotwawki|tlc|tv|ufo)(?=[^\w\']|\_)(\.*)

    Replace matches with:

    $upper($1)

    Any help would be greatly appreciated.

    Sunday, July 11, 2010 2:13 PM

Answers

  • \b(dmx|ac|ad|afi|aol|asap|atm|bbc|bc|bce|blt|btw|cc|cia|cst|csv|dc|dj|dmv|dmx|doa|dst|eod|ep|est|et|faq|fbi|fm|gi|glc|gmo|imo|imho|iq|ira|jc|irs|krs|lp|mc|mst|mtd|mvp|nasa|oj|pc|pi|pj|pm|ps|qed|rv|sos|ssr|usa|ussr|tba|tbd|teotwawki|tlc|tv|ufo)\b


    Regards
    • Proposed as answer by Kirill Polishchuk Sunday, July 11, 2010 2:47 PM
    • Marked as answer by SamAgain Tuesday, July 20, 2010 12:41 AM
    Sunday, July 11, 2010 2:47 PM

All replies

  • \b(dmx|ac|ad|afi|aol|asap|atm|bbc|bc|bce|blt|btw|cc|cia|cst|csv|dc|dj|dmv|dmx|doa|dst|eod|ep|est|et|faq|fbi|fm|gi|glc|gmo|imo|imho|iq|ira|jc|irs|krs|lp|mc|mst|mtd|mvp|nasa|oj|pc|pi|pj|pm|ps|qed|rv|sos|ssr|usa|ussr|tba|tbd|teotwawki|tlc|tv|ufo)\b


    Regards
    • Proposed as answer by Kirill Polishchuk Sunday, July 11, 2010 2:47 PM
    • Marked as answer by SamAgain Tuesday, July 20, 2010 12:41 AM
    Sunday, July 11, 2010 2:47 PM
  • Hi,

      polishchuk's answer should be it. The \b stands for a boundary between word and non-word characters.


    Please mark the right answer at right time.
    Thanks,
    Sam
    Monday, July 12, 2010 3:43 AM