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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

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

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by ZvezdanD »

skywalka wrote:If I use:
Copy featuring artists or [(featuring artist)] from the end of Title to the end of Artist
on
songname (feat. artist2)
you end up with:
artist feat. artist2)
ie There is a close bracket but no open bracket. It would be great if there were no brackets in the artist field.
I have that preset already fixed, the modification will be included with the next version of this add-on. Here is the new Replace with string:
RegSub(RegExp(oSongData.Title, "\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s[^\]\)]+", 0), "^.+$", " $$&")
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
skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am
Contact:

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by skywalka »

ZvezdanD wrote:
skywalka wrote:If I use:
Copy featuring artists or [(featuring artist)] from the end of Title to the end of Artist
on
songname (feat. artist2)
you end up with:
artist feat. artist2)
ie There is a close bracket but no open bracket. It would be great if there were no brackets in the artist field.
I have that preset already fixed, the modification will be included with the next version of this add-on. Here is the new Replace with string:
RegSub(RegExp(oSongData.Title, "\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s[^\]\)]+", 0), "^.+$", " $$&")
Thanks for your help.
I changed the file MediaMonkey\Scripts\Auto\RegExpReplace.ini to:

Code: Select all

Preset167=Name: "Copy featuring artists or [(featuring artist)] from the end of Title to the end of Artist", Description: "Title feat. Artist1, Artist2 or Title [feat. Artist1, Artist2] or Title (feat. Artist1, Artist2) -> Artist feat. Artist1, Artist2", MenuGroup: "Featuring Artists", Shortcut: "", Icon: "", Toolbar: 0, FindWhat: "$", FindInto: "Artist", FindRegExp: 1, WholeWord: 0, ReplaceWith: "RegSub(RegExp(oSongData.Title, "\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s[^\]\)]+", 0), "^.+$", " $$&")", ReplaceFrom: "Title", ReplaceRegExp: 0, ReplaceVBScr: 1, MatchCase: 0
After restarting I got a message asking if I wanted to update the script. I think I selected "no". Should I have selected "yes"?

I still have the parenthesis problem. Can you tell me what I've done wrong?

Thanks again.
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by ZvezdanD »

skywalka wrote:I changed the file MediaMonkey\Scripts\Auto\RegExpReplace.ini
Is there some special reason why you modified that preset manually by editing the mentioned .ini file? There is at least one reason why that is not recommended: double quotes should be doubled, e.g. instead of:
RegSub(RegExp(oSongData.Title, "\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s[^\]\)]+", 0), "^.+$", " $$&")
the .ini should contain:
RegSub(RegExp(oSongData.Title, ""\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s[^\]\)]+"", 0), ""^.+$"", "" $$&"")
Of course, when you save the preset within the program that doubling would be done automatically by the add-on.

Please read the first post of this thread and you will find the answers to your questions, or just search for "By the way, there are two different ways to modify some existing preset".
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
skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am
Contact:

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by skywalka »

ZvezdanD wrote:Is there some special reason why you modified that preset manually by editing the mentioned .ini file?
Sorry, I didn't know what to do.

Thanks for helping a n00b like me.
skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am
Contact:

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by skywalka »

Hi ZvezdanD.

I think the preset:
Replace "&", feat./pres./vs. with "; " in <Into Field>...
should also replace "," ie. commas.

I tried editing the preset manually but it will only replace commas if there is a space before the comma.

Do you think you could share the code that would make this possible?

Thanks for your time.
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by ZvezdanD »

skywalka wrote:I think the preset:
Replace "&", feat./pres./vs. with "; " in <Into Field>...
should also replace "," ie. commas.
I am not sure if I should update that preset since there are some artists which have "," in their names like "Emerson, Lake & Palmer" or "Blood, Sweat & Tears". Well, I had doubt even if I should include "&" into replacement, but I have noted that in the description of that preset.

It is possible to edit that preset to include "," but I am wondering why don't you simply use the most basic preset #1: "Replace specified string with another one in <Into Field>" to replace "," with ";"?

By the way, I just found my old answer to similar request (you should try the Search option of this Forum sometimes). You could read it and maybe you will find that it is more suitable for you: http://www.mediamonkey.com/forum/viewto ... 10#p323210
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
skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am
Contact:

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by skywalka »

ZvezdanD wrote: I just found my old answer to similar request
That is helpful, thanks.
ZvezdanD wrote: there are some artists which have "," in their names like "Emerson, Lake & Palmer" or "Blood, Sweat & Tears".
When multiple artists exist I estimate those with a comma in their name to comprise less than 1%. They are clearly the exception to the rule.
ZvezdanD wrote: I am wondering why don't you simply use the most basic preset #1: "Replace specified string with another one in <Into Field>" to replace "," with ";"?
If the preset is going to handle multiple functions why not handle them all?
ZvezdanD wrote: I am not sure if I should update that preset
I think you should but if you thought the same you would have already implemented it. That's why I asked:
skywalka wrote:Do you think you could share the code that would make this possible?
So you could leave the preset how you think it should be. I'd be really thankful if you can share with me how to do it.

Thanks again.
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by ZvezdanD »

skywalka wrote:If the preset is going to handle multiple functions why not handle them all?
You should try the suggestions which I explained in the linked answer. The Replace with string mentioned there could be modified to include "," since its list of words/characters for replacement begins with \b instead of the "Replace "&", feat./pres./vs. with "; " in <Into Field>"preset which has \s in the front of the word list.

If you click on the "?" button on the bottom left corner of the RegExp Find & Replace dialog box you will find what is a difference between those two regex metacharacters (\b and \s). That is an explanation why you should not use \s if you want to replace "," which don't have space character in the front of it.
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
skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am
Contact:

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by skywalka »

I worked it out.

This is what I came up with:

Code: Select all

\s(&|feat\.?|featuring|features|ft\.?|presenting|,|and|presents|/|pres\.?|versus|vs\.?)\s|(\B|\b)(,)(\b|\s)|\s(feat.|ft.|vs.)\b
Thanx for pointing me in the right direction.
Mike9596
Posts: 6
Joined: Sun Nov 17, 2013 10:49 pm
Contact:

Title Case in tags?

Post by Mike9596 »

I have the RegExp Find & Replace addon and have looked thru its presets, I didn't find any help there. I haven't found anything in the forums either so far.

I want to make sure my titles and other tag fields are title case (first alpha character of each word is upper case and the rest of the word is lower case). Can anyone tell me where I can find (hopefully) a pre-existing RegExp expression that will do that? Of course names like McCartney and O'Connor and the like will be problematic. I'll deal with that once I have or figure out a RegExp to get everything else in title case format.

Thanks,
Mike9596
Last edited by Lowlander on Mon Dec 16, 2013 11:18 am, edited 1 time in total.
Reason: Merged with existing topic
linn
Posts: 170
Joined: Wed Sep 06, 2006 3:59 am
Contact:

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by linn »

I used to be able to copy text from a webpanel into the comment field using "lyrics and comment viewer", this doesn't work anymore, see http://www.mediamonkey.com/forum/viewto ... 50#p377479.
The question: can i use the "Replace with" field to have the clipboard content placed into it?
The idea is to copy the desired text from the webpanel and then use a preset to paste this into the comment field.
Thanks
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: Title Case in tags?

Post by ZvezdanD »

Mike9596 wrote:I want to make sure my titles and other tag fields are title case (first alpha character of each word is upper case and the rest of the word is lower case).
Have you tried the "Capitalize" 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
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by ZvezdanD »

linn wrote:can i use the "Replace with" field to have the clipboard content placed into it?
The idea is to copy the desired text from the webpanel and then use a preset to paste this into the comment field.
Of course you could use the "Replace with" field to paste some clipboard content, but I don't understand why don't you use the Properties dialog for that. Or in-line editing of the Comment field in the main filelist.
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
linn
Posts: 170
Joined: Wed Sep 06, 2006 3:59 am
Contact:

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by linn »

ZvezdanD wrote:
linn wrote:can i use the "Replace with" field to have the clipboard content placed into it?
The idea is to copy the desired text from the webpanel and then use a preset to paste this into the comment field.
Of course you could use the "Replace with" field to paste some clipboard content
,
I looked but couldn't find the option, Could you please tell me how?
but I don't understand why don't you use the Properties dialog for that.
I could , but constructing a Find & replace preset and use a button or keystroke seemed easier.
Or in-line editing of the Comment field in the main filelist.
Sorry , could you please elaborate "in-line editing" thanks
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by ZvezdanD »

linn wrote:I looked but couldn't find the option, Could you please tell me how?
I think that I don't understand what you are trying to do. There is not any special option that you need to be able to paste text into the "Replace with" field - just click on that field and press Ctrl+V. However, if you just want to assign some text to the Comment filed, it would be easier to use the "Assign specified string to Comment field..." preset from the Tag Manipulation Presets menu than using the RegExp Find & Replace dialog box, but I suppose that you already know that since you mentioned "a button or keystroke".
linn wrote:Sorry , could you please elaborate "in-line editing" thanks
If you just want to enter some text into the Comment field of some track, then just select that field in the filelist and press F2 or click one more time on the same field. However, if you want to enter the same text to the several files at once, then you cannot use the in-line editing.
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