RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: bypass "confirm" message on button

Post by ZvezdanD »

markeh wrote:Any way of turning this off, just for these two changes??
Sorry, it is not possible. You could turn on/off confirmation only for all presets.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
RobertSmith
Posts: 157
Joined: Wed Jun 24, 2009 1:05 am
Location: Stockholm, The home of Icebears

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by RobertSmith »

Hi,
My first attempt to write (cut & paste) RegExp. I want a expression for titles to be used for Swedish tracks, not the same standard as for English:

Only the first character in the title should be capitalized. But there are exceptions when using names (ex. Lars, Gunnar Lindholm) or places (ex. Stockholm, New York, London), these should be capitalized too.

I guess the only way to accomplish this is to use a exceptions list. I have modified Uppercase English "I" and the first letter of each line or sentence of the Lyrics

Code: Select all

([\w\xDF-\xF6])((?:[^.](?!\b(?:Sverige|Åre)\b))*)
and it works as long as I don't have exceptions word starting with ÅÄÖ i tried to use

Code: Select all

[\b\xDF-\xF6]
but it didn't work. I took a look at Regex Tutorial but that site didn't help me :(

pls help me!

I also want word like remix, mix, edit etc. when they are inside () to be in lovercase, I tried to update Capitalize the Title with exceptions (ASCII, Latin 1, Latin 2 & Cyrillic)

To get it to work I had to add remix to the exceptions list 3 times:

Code: Select all

\(remix|remix|remix\)
I guess there must be a better way :)

Edit:
This seems to be a better solution, adding:

Code: Select all

\b(single|edit|remix|mix)\b|
to the beginning and change Replace with:

Code: Select all

LCase("$1") & LCase("$2") & UCase("$3") & UCase("$4") & LCase("$5")
Boys Don't Cry
3.1.0.1256 - M$ Vista Business sp1, DELL laptop, WD USB HDD 1TB (iPhone 3GS 32GB, iPod 30GB, Archos AV500 60GB)
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by ZvezdanD »

RobertSmith wrote:I have modified Uppercase English "I" and the first letter of each line or sentence of the Lyrics

Code: Select all

([\w\xDF-\xF6])((?:[^.](?!\b(?:Sverige|Åre)\b))*)
and it works as long as I don't have exceptions word starting with ÅÄÖ
Here is an expression for your example:

Code: Select all

([\w\xDF-\xF6])((?:(?![^\w\xDF-\xF6](?:Sverige|Åre)[^\w\xDF-\xF6])[^.!?\r\n])*)
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: bypass "confirm" message on button

Post by ZvezdanD »

ZvezdanD wrote:
markeh wrote:Any way of turning this off, just for these two changes??
Sorry, it is not possible. You could turn on/off confirmation only for all presets.
Just to clarify... I didn't say that it would not be implemented. I just meant it is not currently possible. I am working on some additions to the working of presets and such individual confirmation would be as some sort of a side effect. I just need a time to finish that new version since there are too much things which should be done.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
RobertSmith
Posts: 157
Joined: Wed Jun 24, 2009 1:05 am
Location: Stockholm, The home of Icebears

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by RobertSmith »

ZvezdanD wrote:Here is an expression for your example:

Code: Select all

([\w\xDF-\xF6])((?:(?![^\w\xDF-\xF6](?:Sverige|Åre)[^\w\xDF-\xF6])[^.!?\r\n])*)
Thy! I have been reeding more from the site you recommended and I have dl RegexBuddy but I still found it complicated... :(

I'm looking for a RegExp to use on title where only the first character in the title should be capitalized. But there are exceptions when using names or places, abbreviation like UK or AB.
This code works if I write abbreviations on two places. I think I understand how it works, the only way to stop the 2nd loop is to put in UK|AB. I guess it could be done in a way there it is enough to specify exceptions word only ones. I have tried many different way, but so far no success, pls help :)

Code: Select all

(\b(?:AB|UK)\b|[\w\xBF-\xF6])((?:(?![^\w\xBF-\xF6](?:AB|UK|Sverige|Åre)[^\w\xBF-\xF6]).)*)
I don't know if you are using RegExpBuddy but I have to begin extended ASCII at xBF (include uppercase letters), if I start with xDF and RegExp flavor = JavaScript/VBScript it wont work
Boys Don't Cry
3.1.0.1256 - M$ Vista Business sp1, DELL laptop, WD USB HDD 1TB (iPhone 3GS 32GB, iPod 30GB, Archos AV500 60GB)
RobertSmith
Posts: 157
Joined: Wed Jun 24, 2009 1:05 am
Location: Stockholm, The home of Icebears

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by RobertSmith »

RobertSmith wrote:
ZvezdanD wrote:Here is an expression for your example:

Code: Select all

([\w\xDF-\xF6])((?:(?![^\w\xDF-\xF6](?:Sverige|Åre)[^\w\xDF-\xF6])[^.!?\r\n])*)
Thy! I have been reeding more from the site you recommended and I have dl RegexBuddy but I still found it complicated... :(

I'm looking for a RegExp to use on title where only the first character in the title should be capitalized. But there are exceptions when using names or places or abbreviation like UK, AB or ÅÄÖ.
This code works OK if I write abbreviations on two places (ÅÄÖ doesn't work,\w works with ext. ASCII, \b only works for 0-127 ?). I think I understand how it works, the only way to stop the 2nd loop is to put in UK|AB|ABC|ÅÄÖ. I guess it could be done in a way there it is enough to specify exceptions word only ones. I have tried many different way, but so far no success, pls help :)

Code: Select all

(\b(?:AB|UK|ÅÄÖ|ABC)\b|[\w\xBF-\xF6])((?:(?!\s(?:AB|UK|Sverige|Åre|ÅÄÖ|ABC)\s).)*)
I don't know if you are using RegExpBuddy but I have to begin extended ASCII at xBF (include uppercase letters), if I start with xDF and RegExp flavor = JavaScript/VBScript it wont work
Boys Don't Cry
3.1.0.1256 - M$ Vista Business sp1, DELL laptop, WD USB HDD 1TB (iPhone 3GS 32GB, iPod 30GB, Archos AV500 60GB)
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by ZvezdanD »

RobertSmith wrote:I'm looking for a RegExp to use on title where only the first character in the title should be capitalized. But there are exceptions when using names or places, abbreviation like UK or AB.
This code works if I write abbreviations on two places. I think I understand how it works, the only way to stop the 2nd loop is to put in UK|AB. I guess it could be done in a way there it is enough to specify exceptions word only ones. I have tried many different way, but so far no success, pls help :)

Code: Select all

(\b(?:AB|UK)\b|[\w\xBF-\xF6])((?:(?![^\w\xBF-\xF6](?:AB|UK|Sverige|Åre)[^\w\xBF-\xF6]).)*)
I suppose it could be easier if you write two presets, one for sentence capitalization and another to uppercase abbreviations. In that case you don't need to specify abbreviations two times.
RobertSmith wrote:I don't know if you are using RegExpBuddy but I have to begin extended ASCII at xBF (include uppercase letters), if I start with xDF and RegExp flavor = JavaScript/VBScript it wont work
Well, \xBF, \xD7 and \xF7 are symbols, not letters, so if you want full Latin-1 character range you should write \xC0-\xD6\xD8-\xF6\xF8-\xFF. However, you don't need to include uppercase letters in a character range because the Match case option is turned off, so it is enough to write \xDF-\xF6\xF8-\xFF or, if you want Latin-2 and Cyrillic as well, you could write \xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF. I am not using RegExpBuddy. Did you try to turn on Case insensitive option in it ("i" flag)?
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
mk1065
Posts: 6
Joined: Thu Feb 14, 2008 9:27 am
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by mk1065 »

50k songs + 2 weeks of countless hours organzing = 1 Bad A** Music Collection!! I am almost have these babies perfect :wink:

As I was about to Auto-Organize my songs I realized that because I have my featured Artist as either "Artist & Artist" or "Artist (ft. Artist)" that I am going to have a lot of folders with duplicate Artist, which ain't cool! So, I think the best solution is to do this:

Find what in Artist field:
1. Artist (ft. Artist)
2. Artist & Artist
3. Artist, Artist & Artist
4. Artist, Artist, Artist & Artist
Replace with in Title field:
1. Title (ft. Artist)
2. Title (ft. Artist)
3. Title (ft. Artist & Artist)
4. Title (ft. Artist, Artist & Artist)

Now that is what I am talking about! Any help would be appreciated please!
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by ZvezdanD »

mk1065 wrote:Find what in Artist field:
1. Artist (ft. Artist)
2. Artist & Artist
3. Artist, Artist & Artist
4. Artist, Artist, Artist & Artist
Replace with in Title field:
1. Title (ft. Artist)
2. Title (ft. Artist)
3. Title (ft. Artist & Artist)
4. Title (ft. Artist, Artist & Artist)
1. example:
- Use "Copy featuring artists from the Artist to the Title field" preset;
- Use preset already posted to you applied to the Title field;
- Use "Remove featuring artists from the end of the Artist" preset if needed.

2-4. examples:
- Use following settings for a new preset "Replace the first "," or "&" in the Artist field with the "ft."":
Find what:

Code: Select all

^([^,&]+?)\s?[,&]\s?
Replace with:

Code: Select all

$1 ft. 
- Use all steps from 1. example.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
RobertSmith
Posts: 157
Joined: Wed Jun 24, 2009 1:05 am
Location: Stockholm, The home of Icebears

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by RobertSmith »

ZvezdanD, Thank you for all your help!!
I have now reading the manual/tutorial 2 times and slowly getting a grip on RegExp :)
So here is my first contribution:

Capitalization for most non-English language according to MusicBrainz

Preset: MBz StyleGuide - Uppercase the first letter of title and lowercase others with exceptions (ASCII, Latin 1, Latin 2 &Cyrillic)
Description: There are some names, places and abbreviations in the Find what string which should be uppercased, you could add others which you want

Code: Select all

((?:^|[\s(])(?:DJ|E\.M\.D|UK|USA)(?=[)\s]|$))|(^.)|((?=[\s(](?:London|Sverige|John|Doe)(?:[)\s]|$))..)|([\w\u00DF-\u00F6\u00F8-\u00FF\u0100-\u024F\u0400-\u04FF]*)

Code: Select all

UCase("$1") & UCase("$2") & UCase("$3") & LCase("$4")
Boys Don't Cry
3.1.0.1256 - M$ Vista Business sp1, DELL laptop, WD USB HDD 1TB (iPhone 3GS 32GB, iPod 30GB, Archos AV500 60GB)
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by ZvezdanD »

RobertSmith wrote:So here is my first contribution:
Wow! I am not so sure, but I think you are the fist person who contributed with some preset. It is also very good one, indeed. Congratulations!
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
RobertSmith
Posts: 157
Joined: Wed Jun 24, 2009 1:05 am
Location: Stockholm, The home of Icebears

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by RobertSmith »

ZvezdanD wrote:Wow! I am not so sure, but I think you are the fist person who contributed with some preset. It is also very good one, indeed. Congratulations!
Thy :D

I did a small modification to the English language track version to make it possible to lower case words like feat. edit, mix etc. just after "(" or just before ")". I also added some words according to MBz Capitalization Standard English. I removed the greedy ? from words like feat. pres. vs. since I prefer (keep the standard) to run "Fix common words (featuring, presents, versus) in the Title" first.

Code: Select all

([\s(](?:as?|and?|at|but|by|cum|for|from|in|into|mid|nor|off?|on|onto|or|per|qua|re|the|to|via|with|o'|'n'|n'|edit|radio|remix|mix|version|feat\.|pres\.|vs\.|del?|des|du|el|las?|les?|los)(?=[)\s]))|(\b(?:III?|DJ|UK|USA))\b|([\w\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF])([\w'\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*)
Last edited by RobertSmith on Fri Jul 10, 2009 11:37 pm, edited 3 times in total.
Boys Don't Cry
3.1.0.1256 - M$ Vista Business sp1, DELL laptop, WD USB HDD 1TB (iPhone 3GS 32GB, iPod 30GB, Archos AV500 60GB)
mk1065
Posts: 6
Joined: Thu Feb 14, 2008 9:27 am
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by mk1065 »

Thanks ZvezdanD!

Gee wiz, your music collection must be in tip-top shape with all your ninja code writing skills!! How many songs do you have?
beg
Posts: 193
Joined: Wed Feb 04, 2009 12:36 pm

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by beg »

great script - thx a lot!

one question though:
how can I configure the icons placed next to the search field? Especially to get rid of the big tabs "increment play" and "decrement play".

I do need the search box, but in the MM configuration of the search menu there are no actions from regexp find & replace. So I wonder how to configure that?

thx,
B
ZvezdanD
Posts: 3264
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by ZvezdanD »

mk1065 wrote:your music collection must be in tip-top shape
Well, I had more or less a good organized music collection even before I started to use audio organizer software.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Post Reply