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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by nynaevelan »

ZvezdanD wrote: You could try the preset "Uppercase the first letter of sentence or each folder/filename of the Path" with selected Title in the Into dropdown list. However, with this preset all words would be converted to the lowercase except the first one of the sentence - so it would be in lowercase also English "I", personal names... If you want I could modify the preset to convert "I" into uppercase, but personal names is somewhat more difficult because it needs a list of all possible names, something like the preset "Capitalize the Title with exceptions".
For this one I think I am just going to use the good old-fashioned stare and compare. I have less than 1000 tracks that I need to review and it will probably be easier to just review them manually than to try to come up with an "automatic" way to do it. Thanks anyway.

For the record, I know absolutely nothing about Regexp, so I am only able to use this script due to the presets. So if you happen to think up any other ones, please add them because illiterates such as myself do appreciate them. You can be my Regexp expert, to join the team of my SQL experts. Who knows one day I may actual understand what I am doing. :wink:

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

nynaevelan wrote:What is the difference between Keep to Replace an Select to Replace?
Well, with my limited English knowledge I could hardly better describe this than it is already described in the What is new section for v2.1, so it is the best if you try them by yourself - nothing harmful to your database could happen, because both of those options are non-destructive.

In short, with the Select to Replace option (Sel. replace) you could select all tracks that could be modified, but all tracks stay visible in the tracklist as before entering in the RegExp dialog box. On the other side, with the option Keep to replace (Keep replace) you could keep only tracks that could be modified and other tracks from the tracklist would be removed (don't worry, they will not be removed from the database).

I'd be glad if you (or someone else with better English than mine) could write some short description for this, so I could put it in the FAQ section of the first post. Thanks in advance.
nynaevelan wrote:For this one I think I am just going to use the good old-fashioned stare and compare.
Did you tried mentioned preset? I think it does exactly what you want, with mentioned exceptions. Even with a few manual corrections to this preset it could be faster than trying to manually edit all titles.
nynaevelan wrote:So if you happen to think up any other ones, please add them because illiterates such as myself do appreciate them.
No problem at all, but there are two things: 1. I don't know what could be useful for users, so please let me know; 2. there are already too many presets and it would be hard for navigation if I add some more, especially in the main menu. For the next release of this script I will remove some less useful presets to be able to add some new and more interesting.
nynaevelan wrote:Who knows one day I may actual understand what I am doing.
If you want to learn something new, you could try with the "Regular expressions quick reference" which you get with a click on the "?" button on the left bottom corner of the RegExp dialog box. There are many Internet sites dedicated to this, for example http://www.regular-expressions.info where you could find a nice on-line tutorial. There are also useful informations about Regular expressions at http://en.wikipedia.org/wiki/Regular_expression. Trust me, once when you learn this, you will ask yourself how could you live without it. Regular expressions are really helpful for so many tasks. But, in fact, it is very easy to start with them. Just take a look on the expression \s{2,} - with it you could find all occurrences of two or more consecutive space characters. How about colou?r - it would match both "color" and "colour"...
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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by nynaevelan »

ZvezdanD wrote:
nynaevelan wrote:What is the difference between Keep to Replace an Select to Replace?
Well, with my limited English knowledge I could hardly better describe this than it is already described in the What is new section for v2.1, so it is the best if you try them by yourself - nothing harmful to your database could happen, because both of those options are non-destructive.

In short, with the Select to Replace option (Sel. replace) you could select all tracks that could be modified, but all tracks stay visible in the tracklist as before entering in the RegExp dialog box. On the other side, with the option Keep to replace (Keep replace) you could keep only tracks that could be modified and other tracks from the tracklist would be removed (don't worry, they will not be removed from the database).

I'd be glad if you (or someone else with better English than mine) could write some short description for this, so I could put it in the FAQ section of the first post. Thanks in advance.
I don't think I would be the best person to write up an explanation since I am not 100% sure what I am doing.
ZvezdanD wrote: No problem at all, but there are two things: 1. I don't know what could be useful for users, so please let me know; 2. there are already too many presets and it would be hard for navigation if I add some more, especially in the main menu. For the next release of this script I will remove some less useful presets to be able to add some new and more interesting.
It's not too bad because the user has the option to get rid of presets which he/she would not be using. And the presets are useful because they are a stepping stone to creating new presets or modifying existing ones to meet the user's needs. Without them I wouldn't be able to use this script. Besides, how do you know which ones are less useful??
ZvezdanD wrote: If you want to learn something new, you could try with the "Regular expressions quick reference" which you get with a click on the "?" button on the left bottom corner of the RegExp dialog box. There are many Internet sites dedicated to this, for example http://www.regular-expressions.info where you could find a nice on-line tutorial. There are also useful informations about Regular expressions at http://en.wikipedia.org/wiki/Regular_expression. Trust me, once when you learn this, you will ask yourself how could you live without it. Regular expressions are really helpful for so many tasks. But, in fact, it is very easy to start with them. Just take a look on the expression \s{2,} - with it you could find all occurrences of two or more consecutive space characters. How about colou?r - it would match both "color" and "colour"...
I tried looking at one of the tutorials but it was all a foreign language to me. Maybe one day when I have time to dedicate to learning it, but for now I'll just stick to modifying presets. Besides I am still in the learning process for SQL and my brain can only handle one at a time when it comes to computer languages.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

nynaevelan wrote:I don't think I would be the best person to write up an explanation since I am not 100% sure what I am doing.
Maybe my description was not very clear, so here is one example. Let say that I selected some tree node and as a result I got the tracklist with 10 tracks. After that I unselected all tracks in the tracklist and entered the RegExp dialog box. Let say that I choose some preset which could modify 3 tracks of those 10. Now, I have two possibilities:
1. if I choose Select to replace, after closing RegExp dialog box I would get the tracklist which will contain 10 visible tracks and 3 of them will be selected;
2. if I choose Keep to replace, after closing dialog box I would get the tracklist which will contain only 3 tracks, those which content needs to be replaced - other 7 tracks will be removed from the tracklist.
If you need some better explanation, please let me know.
nynaevelan wrote:It's not too bad because the user has the option to get rid of presets which he/she would not be using.
Yeah, you are right - I could add them some more and users could remove unwanted presets, but I still don't know what could be useful for users, so please give me some idea and tell me what you want to see with the next version.
nynaevelan wrote:I tried looking at one of the tutorials but it was all a foreign language to me.
Yes, I know, it was same to me. But, you don't need to use all RegExp possibilities from the begin. You could learn step by step, from simplest one to the more difficult. Here is a simplest example: if you want to find all artist which contain prefixes The, A and An, you should write The|A|An (note the character "|" between options). Now, if you want to find all artists which contain mentioned prefixes, but only if they are on the begin of the artist name, you should add the character "^" on the begin of the expression, like this ^(The|A|An) (in this case you need to enclose those options, i.e. prefixes within braces). Isn't that so nice? With just few characters you could find exactly all what you want with a single step.

By the way, I've got your file, thank you very much. There is a SQLite error with it "Expression tree is too large (maximum depth 1000)" which is obviously a consequence of too many selected tracks. Well, in fact it is consequence of too many tracks which would not be modified, especially when there is a random order between them (ideally, they should be consecutive as much as possible to be able for script to use fewer BETWEEN keywords). I could try to resolve this, but I think it would slow down an execution of this option (Select to replace). Thanks again.
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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by nynaevelan »

ZvezdanD wrote:
nynaevelan wrote:I don't think I would be the best person to write up an explanation since I am not 100% sure what I am doing.
Maybe my description was not very clear, so here is one example. Let say that I selected some tree node and as a result I got the tracklist with 10 tracks. After that I unselected all tracks in the tracklist and entered the RegExp dialog box. Let say that I choose some preset which could modify 3 tracks of those 10. Now, I have two possibilities:
1. if I choose Select to replace, after closing RegExp dialog box I would get the tracklist which will contain 10 visible tracks and 3 of them will be selected;
2. if I choose Keep to replace, after closing dialog box I would get the tracklist which will contain only 3 tracks, those which content needs to be replaced - other 7 tracks will be removed from the tracklist.
If you need some better explanation, please let me know.
That makes perfect sense, you don't need me to write up an explanation. :wink:
ZvezdanD wrote:
nynaevelan wrote:It's not too bad because the user has the option to get rid of presets which he/she would not be using.
Yeah, you are right - I could add them some more and users could remove unwanted presets, but I still don't know what could be useful for users, so please give me some idea and tell me what you want to see with the next version.
If I come up with something, I'll let you know, right now I think I have what I need.
ZvezdanD wrote:
nynaevelan wrote:I tried looking at one of the tutorials but it was all a foreign language to me.
Yes, I know, it was same to me. But, you don't need to use all RegExp possibilities from the begin. You could learn step by step, from simplest one to the more difficult. Here is a simplest example: if you want to find all artist which contain prefixes The, A and An, you should write The|A|An (note the character "|" between options). Now, if you want to find all artists which contain mentioned prefixes, but only if they are on the begin of the artist name, you should add the character "^" on the begin of the expression, like this ^(The|A|An) (in this case you need to enclose those options, i.e. prefixes within braces). Isn't that so nice? With just few characters you could find exactly all what you want with a single step.
I'll try to look at the tutorials this week and try to compare that with the presets that are available to see if I understand exactly what is going on. Thanks for taking the time to try to help me understand this better, I do appreciate it. :)
ZvezdanD wrote:By the way, I've got your file, thank you very much. There is a SQLite error with it "Expression tree is too large (maximum depth 1000)" which is obviously a consequence of too many selected tracks. Well, in fact it is consequence of too many tracks which would not be modified, especially when there is a random order between them (ideally, they should be consecutive as much as possible to be able for script to use fewer BETWEEN keywords). I could try to resolve this, but I think it would slow down an execution of this option (Select to replace). Thanks again.
I'm not sure it is really necessary to make any changes, I have the keep to replace option, which works and it's probably best not to do so many files at once anyway. Although with that between option I do not know how I would prevent that since there isn't an option in MM to sort by the SongID. :-?

I just imported several new files into my db, so I am going to use them as tests for trying out presets which I haven't used.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by nynaevelan »

Ok, I need help again. How do I take the Remove trailing/leading spaces from the Title preset and have it remove the spaces at the end of the line? I tried to run it as it but is is not identifying the tracks with just one trailing space.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

nynaevelan wrote:How do I take the Remove trailing/leading spaces from the Title preset and have it remove the spaces at the end of the line? I tried to run it as it but is is not identifying the tracks with just one trailing space.
You should be more specific. "The end of the line" of what? The Title cannot contain multiple lines of text, so the mentioned preset removes spaces only from the Title's begin and the end. If you want to remove trailing/leading spaces from each line of the Lyrics or the Comment, you could use following settings:
Find what:

Code: Select all

( *)(.*?)( *)($|\r\n)
Replace with:

Code: Select all

$2$4
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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by nynaevelan »

I'm running it on the Title field which only has the one line, but the script did not bring up any of the tracks which had a trailing space.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

nynaevelan wrote:I'm running it on the Title field which only has the one line, but the script did not bring up any of the tracks which had a trailing space.
Are you sure that you have titles with trailing spaces? I just tried this preset and it works fine. Could you specify some title?
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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by nynaevelan »

ZvezdanD wrote:
nynaevelan wrote:I'm running it on the Title field which only has the one line, but the script did not bring up any of the tracks which had a trailing space.
Are you sure that you have titles with trailing spaces? I just tried this preset and it works fine. Could you specify some title?


Yes I'm sure, I identified them using Bex's Tagging Inconsistencies script, I ended up removing the trailing spaces manually but this is something I normally have to do when changing tags on new tracks so I would like to get this working for the future.

When I selected the tracks and opened RegExp, it did not highlight the Title field. Then I selected the keep to replace option and it still did not identify the tracks.

Do you think it did not identify them because they only had 1 extra space at the end of the field?

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

nynaevelan wrote:Do you think it did not identify them because they only had 1 extra space at the end of the field?
No, I don't think so. This preset should remove any number of spaces from the title's begin and/or end. Please, could you copy/paste here some of your titles which has trailing space? Or maybe a screenshoot of the RegExp dialog?
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
Seeker
Posts: 264
Joined: Tue Jul 10, 2007 3:17 pm
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by Seeker »

First, I want to thank you for the absolutely best script that no one understands how to use.

It's very mathematical/string based, so maybe that's why people don't understand it.

But it is the most powerful script I've found.

I agree some of your presets don't mean much - maybe you could look at what people request as a potential set of "interesting" presets - since someone wanted them.

Here's one I want - the presets don't work for me even though I substituted .ft (you didn't have that one in your string list):

Since mediamonkey prefers the semicolon to separate artists, but I'd still like to know who was featured, etc. I'd love the ability to:

simply copy the current artist field to the Involved People (or Original Artist) field (assumes Involved People (or Original Artist) field is empty - I don't know how to make your script complain if that field is not empty)

Then, take the artist field and replace .ft or ft or feat and so on with semicolon separations.

Example:

Bow Wow ft. Chris Brown & Johnta Austin

Copy Bow Wow ft. Chris Brown & Johnta Austin to Involved People or Original Artist field

Replace artist string with:

Bow Wow; Chris Brown; Johnta Austin
Seeker
Posts: 264
Joined: Tue Jul 10, 2007 3:17 pm
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by Seeker »

And of course you'll never handle every case - I just found:

R. Kelly or Bow Wow ft. T.I. & T

Which I GUESS should be:

R. Kelly; Bow Wow; T.I.; T

but since I don't know the artists or song in this case, I'm not even sure that's what I'd want.

"or" - ???? - does that mean they sing sometimes and sometimes they don't? Even though I'm good at English - this one throws ME.
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by nynaevelan »

ZvezdanD wrote:
nynaevelan wrote:Do you think it did not identify them because they only had 1 extra space at the end of the field?
No, I don't think so. This preset should remove any number of spaces from the title's begin and/or end. Please, could you copy/paste here some of your titles which has trailing space? Or maybe a screenshoot of the RegExp dialog?
Ok, don't be mad at me :oops:, but I was using the Remove multiple spaces from the Title preset instead of the Remove trailing/leading spaces from the Title preset. All is well in my world again. Thanks for your help.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
ZvezdanD
Posts: 3112
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

Seeker wrote:simply copy the current artist field to the Involved People (or Original Artist) field (assumes Involved People (or Original Artist) field is empty
Did you tried the preset "Copy the Artist to the Original Artist only if it is empty"? However, I think it should be better to use presets "Add featuring artists from the Artist field to the list of Involved people" and "Add main artists with a collaboration from the Artist field to the list of Involved people".
Seeker wrote:Then, take the artist field and replace .ft or ft or feat and so on with semicolon separations.
If you have only one main artist and one featuring artist you could use the preset "Fix common words (featuring, presents, versus)", with the next modification for the Replace with string:

Code: Select all

MapArray(Array("$1", ";", "$2", ";", "$3", ";")) & " "
For more complicated artist's names which contain more involved artist where you have "," and "&" between them, it should be better if you wait for the next version of MediaMonkey which will have better support for the Involved people field.
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