Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.
Also make sure you've read the Forum Guidelines before posting in this forum.
![]() ![]() |
Mar 25 2007, 20:05
Post
#16
|
|
|
Member Group: Members Posts: 1 Joined: 25-March 07 Member No.: 4665 Mp3tag Version: 2.37a |
It's taken me far too long to figure it out but I've finally got it working.
To change Horne, Lena to Lena Horne or Hawkins, Coleman With Manny Albam & His Orchestra to Coleman Hawkins With Manny Albam & His Orchestra Field: ARTIST Regular Expression: ^([\w]+),\s([\w]+) Replace Matches with: $2 $1 I hope I didn't miss the answer in here somewhere. If there's an easier or better way please feel free to help. |
|
|
|
Nov 20 2007, 07:16
Post
#17
|
|
|
Member Group: Members Posts: 1 Joined: 20-November 07 Member No.: 5963 Mp3tag Version: 2.39 |
This regex can remove/replace all but the last dot from a string. It's useful for people like me who prefer to limit filename chars to a-z, 0-9, '_', and '-'. We need to save that last dot for file extensions.
Regex: [.](?![\w]{2,4}$) Assumes file extensions are 2-4 chars long (not including the dot). If you are curious how this works google regex lookaround. This post has been edited by neilpa: Nov 20 2007, 07:18 |
|
|
|
Jan 22 2008, 01:13
Post
#18
|
|
|
Member Group: Members Posts: 1 Joined: 22-January 08 Member No.: 6340 Mp3tag Version: 2.39 |
I recently converted all my wma files to mp3 only to realize that all the tags were lost. My music is in the form:
...\artist\album\track title.mp3 MP3TAG came to my rescue! Not sure whether there was an easier way to do this, but I got started by reading this. Sorry if these are lame ways of doing it, but it's my 1st experience with regexp. format artist: $regexp(%_folderpath%,.+\\(.+)\\(.+)\\,$1) format album: $regexp(%_folderpath%,.+\\(.+)\\(.+)\\,$2) Next 2 I got from ThurstonX in this post. format track: $regexp(%_filename%,(\d*)\s?(.+),$1) format title: $regexp(%_filename%,(\d*)\s?(.+),$2) This program saved me TONS of time... |
|
|
|
Sep 1 2008, 23:02
Post
#19
|
|
![]() Member Group: Full Members Posts: 92 Joined: 16-August 06 From: Portugal (North) Member No.: 3569 Mp3tag Version: 2.48 |
Another member helped me creating one of the most useful REGEXP that i use so far:
From this: Röyksopp - Beautiful DAY withOUT yoU (Rex The Dog Remix) To this: Röyksopp - Beautiful day without you (Rex The Dog Remix) USING: Action type: Replace with regular expression Field: TITLE Regular expression: ^(.*?)(\(|$) Replace matches with: $caps3($1)$2 [ ] case-sensitive comparison See the original thread here -------------------- Pedro Vieira
|
|
|
|
Oct 24 2008, 23:08
Post
#20
|
|
|
Member Group: Members Posts: 1 Joined: 24-October 08 Member No.: 7778 Mp3tag Version: 2.41 |
Really simple but this will remove any parenthesis and its contents in any part of the string
Example: Blah (blah1) (blah 2) Result: Blah Regular expression: \(.+?\) Replace matches with: This post has been edited by KCE: Oct 24 2008, 23:08 |
|
|
|
Dec 5 2008, 04:56
Post
#21
|
|
|
Member Group: Full Members Posts: 8 Joined: 19-December 07 Member No.: 6142 Mp3tag Version: 243 |
I dislike it when a leading zero appears in the track number of the track tag (or when the total track count is added after a '/' char).
[Aside: It seems like a bad idea to pollute a nice simple tag like the track with extra information like this. My intuition is that the information in each tag should be kept as simple and pure as possible. In databases there is a similar concept: you usually want to achieve what is called a normalized design. But if someone has a good reason for doing otherwise, please educate me! Note that I only have a problem with leading zeroes in the track TAGS. In contrast, when I use tracks in filenames, I DO like a leading zero if there are > 9 tracks on the CD because that causes the filenames to be lexicographically ordered, which is critical for proper sorting by your file system, as well as it visually looks better when filenames are displayed in a list.] Earlier in this thread, phoenixdarkdirk pointed out how to remove any '/' char and following digits. Here is how to remove any leading zeroes (as well as trimmable whitespace): Regex: CODE \s*0(\d+)\s* Replace with: CODE $1
|
|
|
|
Dec 5 2008, 05:17
Post
#22
|
|
|
Member Group: Full Members Posts: 8 Joined: 19-December 07 Member No.: 6142 Mp3tag Version: 243 |
Actually, here is a single regex that does everything that I want:
Regex: CODE \s*0?(\d+)(\s*/\s*\d+)?\s* Replace with: CODE $1 [/quote] This will remove any trimable whitespace around the number (which will be the track tag in my case), remove any leading zero from the number, and remove any suffix after the number that starts with a '/' char (e.g. the total track count). This post has been edited by captainmidnight: Dec 5 2008, 05:18 |
|
|
|
Mar 14 2009, 14:59
Post
#23
|
|
|
Member Group: Members Posts: 1 Joined: 14-March 09 Member No.: 9067 Mp3tag Version: 2.41 |
It's taken me far too long to figure it out but I've finally got it working. To change Horne, Lena to Lena Horne or Hawkins, Coleman With Manny Albam & His Orchestra to Coleman Hawkins With Manny Albam & His Orchestra Field: ARTIST Regular Expression: ^([\w]+),\s([\w]+) Replace Matches with: $2 $1 I hope I didn't miss the answer in here somewhere. If there's an easier or better way please feel free to help. I've just spent a while figuring this out myself, and came on here to post it only to find someone else already has Mine is quite similar Filed: ARTIST RegExp: ^(.+),\s+(\w*) Replace With: $2 $1 Seems to work the same |
|
|
|
Nov 8 2009, 05:23
Post
#24
|
|
|
Member Group: Members Posts: 4 Joined: 8-November 09 Member No.: 11252 Mp3tag Version: 2.45a |
|
|
|
|
Nov 8 2009, 20:43
Post
#25
|
|
![]() Developer Group: Admin Posts: 7621 Joined: 12-December 01 From: Germany, Dresden Member No.: 203 Mp3tag Version: 2.55a |
I've split some off-topic posts to Problem with Actions and Regular expressions.
-------------------- |
|
|
|
Nov 19 2009, 10:48
Post
#26
|
|
|
Member Group: Full Members Posts: 11 Joined: 19-November 09 From: Bodensee Member No.: 11322 Mp3tag Version: 2.48 |
This is not a regular expression for mp3tag, but a link to a page which contains lots of information about creating and using regular expressions.
In my oppinion everybody who uses regexp should have read it www.regular-expressions.info kind regards, Matthias |
|
|
|
Feb 19 2010, 10:24
Post
#27
|
|
|
Member Group: Full Members Posts: 27 Joined: 3-December 07 From: Hungary, Eger Member No.: 6040 Mp3tag Version: 2.55a |
Switches first and last names
Another one, that switches first and last names (for instance, Jacques Brel will become Brel, Jacques): Regular Expression: ^(.+)\s(.+)$ Replace with: $2, $1 Thank you! I developed it a little. Variant A It will not change those artists, where the conversion already done (artist has comma). Example: Brel, Jacques William remains Brel, Jacques William Action: regular expression Field: ARTIST Variant B It handles multipled for WMP artists (in format "artist1/artist2/artist3"), possible nicknames at the end in square brackets and trims unnecessary white spaces. Example: Elvis Presley /Brel, Jacques/ Gabriele Susanne Kerner [Nena ] will Presley, Elvis/Brel, Jacques/Kerner, Gabriele Susanne [Nena] Action group 1. action: regular expression (trim white spaces) Field: ARTIST 2. action: regular expression (multiple white spaces replace to 1) Field: ARTIST 3. action: replace (delete white space after opening bracket) Field: ARTIST 4. action: replace (delete white space before closing bracket) Field: ARTIST 5. action: split fields by separator (for the next actions) Field: ARTIST6. action: regular expression (switches names without nickname) Field: ARTIST 7. action: regular expression (switches names with nickname) Field: ARTIST 8. action: merge duplicate fields (...back) Field: ARTIST This post has been edited by incifinci: Feb 19 2010, 11:05 |
|
|
|
Jun 27 2010, 19:34
Post
#28
|
|
![]() Member Group: Full Members Posts: 7 Joined: 17-July 06 Member No.: 3449 Mp3tag Version: 2.49 |
These are my Reg-Expressions there may be duplicates to what have previously been posted, or there are small changes to fix the many errors that the posted Reg-Expressions create. I have done a lot of testing to make sure these do what they say they do and nothing else. I hope this also allows me a place to create a back up.
Thank-you! Updated: (June/10/2011) Mp3tag 2.49 Action Group:Aa CODE RE: Remove track number from title, ex."1 - Title" < "Title".
Field:TITLE re:^\s*\d+\s*-\s* Nothing: RE: Remove "The" from artist, ex."The Artist" < "Artist". Field:ARTIST re:^The\s+ Nothing: Case conversion: Field:_TAG Case conversion:Mixed Case /[({"-_ RE:Capitalize Roman Numerals up to 399. (trimmed down from 3999 RE:to reduce false positives) - http://bit.ly/lZdZsj Field:_Tag re:(?<!')\b(?=[CLXVI])((C{0,3})?((X[LC])|(L?X{0,3})|L)?((I[VX])|(V?(I{0,3}))|V)?)\b $upper($0) RE: Capitalize Zero stop Acronyms and Initialisms. - http://bit.ly/jADbI6 Field:_Tag re:(? mv|doa|dst|eod|ep|est|et|faq|fbi|fm|gi|glc|gmo|imo|imho|iq|ira|jc|irs|krs|la|lp| m c|mst|mtd|nasa|oj|pc|pi|pj|pm|ps|qed|rv|sos|ssr|usa|ussr|tba|tbd|teotwawki|tlc|t v |ufo)(?=[^\w\']|\_|$)(\.*) $upper($1) RE: Capitalize the Letter Infront of a period. A.B.C. Field:_Tag re:(?<=\.)([^\W\d\_]) $upper($1) RE: Capitalize the Letter Infront of a Space and Apostrophe. Field:_Tag re:(?<=\s')([^\W\d\_]) $upper($1) RE: Lower Case Prepositions, Articles and, Coordinating Conjunctions. Field:_Tag re:(?<=\w\s)(a|as|at|an|about|above|across|after|against|along|alongside|although|amo ng|and|around|as|at|because|before|behind|below|beneath|beside|between|beyond|bu t |by|de|despite|down|during|even|except|excepting|for|from|if|in|inside|into|like | near|next|nor|of|off|on|onto|or|out|outside|over|past|regarding|round|since|so|t h an|the|through|throughout|till|to|toward|under|underneath|unlike|until|up|upon|v o n|when|while|with|within|without|yet)(?=\s\w) $lower($0) RE: Lower Case Abbreviations, Add Stop. Field:_Tag re:(?<=[^\w\']|\_)(alt|ave|capt|cent|corp|div|ed|eg|etc|fag|feat|gen|hr|ie|inc|inst|lb|ltd| min|mt|op|pl|pop|pseud|pt|pub|rev|sec|ser|sgt|st|univ|vs|vol)(?=[^\w\']|\_)(\.*) $lower($1). RE: Add Space Before, & ( { [ + = Field:_Tag re:([^\W\_])([&\(\{\[\+\=]) $1 $2 RE:Add Space After, & ) } ] ; : , ! + = Field:_Tag re:([&\)\}\]\;\:\,\!\+\=])([^\W\_]) $1 $2 RE: Add Space After, . http://bit.ly/jADbI6 Field:_Tag re:(?<!^)(?<!\d|\s|\.)(\.)([^\W\d\_])(?!\.|\s|$) $1 $upper($2) RE: Add Space After, " " Field:_Tag re:(".*?")([^\W\_])(?!$) $1 $2 RE: Add Space Before, " " Field:_Tag re:([^\W\_])(".*?") $1 $2 RE: Remove Spaces After, ( [ { Before, ] } ) ? : ; , ! . Field:_Tag re:([\(\[\{])\s+|\s+([\]\}\)\?\:\;\,\!\.]) $1$2 RE: Remove Spaces Before / After. Field:_Tag re:\s+(\/)\s+ $1 RE: Remove Spaces inside, " " Field:_Tag re:"\s*(.*?)\s*" "$1" RE: Remove Spaces Before and After String. Field:_Tag re:^\s+|\s+$ Nothing: RE: Remove all Double+ Spacing. Field:_Tag re:\s{2,} One Space: RE: Add Apostrophe to Are Contractions. Field:_Tag re:\b(how|they|what|when|where|why|you)re(?=[^\w\']|\_|\$) $1're RE: Add Apostrophe to Had/Would Contractions. Field:_Tag re:\b(he|how|i|it|she|they|we|what|where|who|why|you)d(?=[^\w\']|\_|\$) $1'd RE: Add Apostrophe to Have Contractions. Field:_Tag re:\b(could|how|i|might|must|should|we|what|when|where|would|you)ve(?=[^\w\']|\_|\$) $1've RE: Add Apostrophe to Is Contractions. Field:_Tag re:\b(he|here|how|it|let|she|that|there|two|what|when|where|who|why)s(?=[^\w\']|\_|\$) $1's RE: Add Apostrophe to Not Contractions. Field:_Tag re:\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shoul dn|wasn|weren|won|wouldn)t(?=[^\w\']|\_|\$) $1't RE: Add Apostrophe to Will Contractions. Field:_Tag re:\b(how|i|it|she|that|there|they|what|when|where|who|why|you)ll(?=[^\w\']|\_|\$) $1'll RE: Add Apostrophe to Am Contractions. Field:_Tag re:\b(i)m(?=[^\w\']|\_|\$) $1'm RE: Add Apostrophe to Do Ya Contraction. Field:_Tag re:\b(D)ya(?=[^\w\']|\_|\$) $1'ya RE: Add Apostrophe to Do You Contraction. Field:_Tag re:\b(D)you(?=[^\w\']|\_|\$) $1'you RE: CamelCase Mc Words. Field:_Tag re:\bMc(?=.) Mc$upper($1) RE:CamelCase O' Words. Field:_Tag re:\bO'([^\W\d\_e]) O'$upper($1) This post has been edited by Zoofield: Jun 11 2011, 05:18
Attached File(s)
-------------------- |
|
|
|
Aug 16 2010, 11:38
Post
#29
|
|
|
Member Group: Full Members Posts: 8 Joined: 28-September 04 Member No.: 1227 |
My title and/or filename looks like:
Gospel&spiritual 1 - Track 03.[128kb 44khz 2'34] I want to delete the suffix: '.[128kb 44khz 2'34]'. I do it the way: Field: TITLE RegExp: (.*)\.\[[0-9]+kb\s[0-9]+khz.*\] Replace with: $1 Just change that to the field _FILENAME if you want to do it for the filename. If you want to take a more easy solution (for example delete everything after the first dot, ...) see the next posts from DetlevD or RevRagnarok. Update: Added a '\' befor the dot, to make sure, only a real dot before the '[' will be replaced, thx to RevRagnarok for the hint. This post has been edited by d003232: Aug 17 2010, 15:35 |
|
|
|
Aug 16 2010, 17:22
Post
#30
|
|
![]() Member Group: Full Members Posts: 4129 Joined: 26-May 06 From: Wuppertal, Germany, Planet Earth Member No.: 3194 Mp3tag Version: 2.54 |
...Gospel&spiritual 1 - Track 03.[128kb 44khz 2'34] ... I want to delete the suffix: '.[128kb 44khz 2'34]' ... This is a good example for the situation, where someone does not really need to learn the regular expression language, but instead use a simple action. Actiontype 7: Import tag fields (guess values) Source format: %TITLE% Guessing pattern: %TITLE%.%DUMMY% From: Gospel&spiritual 1 - Track 03.[128kb 44khz 2'34] To: Gospel&spiritual 1 - Track 03 DD.20100816.1822.CEST This post has been edited by DetlevD: Aug 16 2010, 17:23 -------------------- * Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥ |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 24th May 2013 - 13:55 |