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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

RabanePaco
Posts: 87
Joined: Fri Jul 27, 2007 7:58 am
Location: Leiden, The Netherlands

Can't install RegExp F&R w/o scripts. MM3.1 problem?

Post by RabanePaco » Thu Jun 18, 2009 4:47 am

When I try to install RegExp F&R without the 101 sample presets I get the error message

Error #-2147419113 - SongsDB.SDBStringlist
List index out of bounds (0)
File ....\MM\scripts\Auto\RegExpReplace.vbs

There is not the RegExp menu item under Edit.

Installing with the presets seems to be o.k. (so I'll try them anyway :) )

I just updated to MM 3.1. I'm also using MagigNodes. I didn't use RegExp before (didn't know about it).

It seems a very intersting script. I have been using Mp3Tag extensively.
        -- RabanePaco

MM 4.1.14.1813, RegExp Find & Replace
System: Windows 10, 64 bits, all updates. Intel(R) Core(TM) i5, 3.20GHz, 4 Core(s), 8 GB main memory, 250 GB SSD, etc.
NetGear NAS 2 TB, 822 albums, 14+ k tracks, 110 GB, 10000 hours playinmg time.
SqueezeBox Duet, iPod (classic)

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

Re: Can't install RegExp F&R w/o scripts. MM3.1 problem?

Post by ZvezdanD » Thu Jun 18, 2009 7:37 am

RabanePaco wrote:When I try to install RegExp F&R without the 101 sample presets I get the error message
Thanks for the report. There is a new release: v3.5.1 - 2009-06-18
- Fixed: error during start-up if none preset exists.
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

stutes
Posts: 101
Joined: Mon May 12, 2003 9:06 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by stutes » Fri Jun 26, 2009 10:11 pm

Just wondering if it is possible to append one field with another field. I would like to take the information in fields such as "Mood" and "Tempo" and append the data in the field to the Grouping field, ideally putting a comma and then a space before the data is added to the Grouping field.
Version: MediaMonkey 3.1.0.1236
Syncs iPod Touch 2nd Gen (firmware 2.2) and SD cards via card reader
(Touch also syncs with iTunes on a Mac, OS X 10.5, set manage podcasts, apps, photos, contacts & calendar, but NOT music)

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

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by ZvezdanD » Sat Jun 27, 2009 5:01 pm

stutes wrote:Just wondering if it is possible to append one field with another field. I would like to take the information in fields such as "Mood" and "Tempo" and append the data in the field to the Grouping field, ideally putting a comma and then a space before the data is added to the Grouping field.
Of course this is possible, you already have several predefined presets which combines two or more fields into one field, e.g. "Add the Track number to the begin of the Title". Here are settings for your example:
Find what:

Code: Select all

^.*
Into: Grouping
Regular expression 1: checked
Replace with:

Code: Select all

"$&" & IIf(Len(oSongData.Mood) > 0 And Len("$&") > 0, ", ", "") & oSongData.Mood & IIf(Len(oSongData.Tempo) > 0 And Len("$&" & oSongData.Mood) > 0, ", ", "") & oSongData.Tempo
VBScript expression: checked

The Replace with expression could be much simpler if you remove checking for empty fields, i.e. if you have all fields entered.
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

stutes
Posts: 101
Joined: Mon May 12, 2003 9:06 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by stutes » Sat Jun 27, 2009 11:08 pm

ZvezdanD, thank you for the reply. I figured RegExp could do this, but I couldn't figure out how to make it work with the fields I wanted to work with. I've no knowledge of VBscript.

I don''t think I need it to check for empty fields, and I didn't realize I could get it to append BOTH the Mood AND Tempo fields AT ONCE into the Grouping field—that's pretty cool! I was assuming I'd have to run it once to append the Mood to Grouping and then again to append the Tempo to Grouping.

I was also hoping to do the same thing with Custom 2 and Custom 3 (again, no need to check for empty fields as far I as I can tell... unless empty fields cause problems), and append the data in those fields to the Grouping field.

Would I be correct in assuming that the code for Custom 2 and 3 would look something like this?:

Code: Select all

    "$&" & IIf(Len(oSongData.Custom2) > 0 And Len("$&") > 0, ", ", "") & oSongData.Custom2 & IIf(Len(oSongData.Custom3) > 0 And Len("$&" & oSongData.Custom2) > 0, ", ", "") & oSongData.Custom3
Version: MediaMonkey 3.1.0.1236
Syncs iPod Touch 2nd Gen (firmware 2.2) and SD cards via card reader
(Touch also syncs with iTunes on a Mac, OS X 10.5, set manage podcasts, apps, photos, contacts & calendar, but NOT music)

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

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by ZvezdanD » Sun Jun 28, 2009 2:05 am

stutes wrote:Would I be correct in assuming that the code for Custom 2 and 3 would look something like this?:

Code: Select all

    "$&" & IIf(Len(oSongData.Custom2) > 0 And Len("$&") > 0, ", ", "") & oSongData.Custom2 & IIf(Len(oSongData.Custom3) > 0 And Len("$&" & oSongData.Custom2) > 0, ", ", "") & oSongData.Custom3
Yes, your Replace with string is correct. However, if you don't want to check for empty fields, you could write previous two presets as one, i.e. you could append Mood, Tempo, Custom 2 and Custom 3 in one go:

Code: Select all

"$&, " & oSongData.Mood & ", " & oSongData.Tempo & ", " & oSongData.Custom2 & ", " & oSongData.Custom3
But, if you have some field empty, e.g. Tempo, with such string you would get something like Grouping, Mood, , Custom2, Custom3. Or, if you have empty Grouping, you would get , Mood, Tempo, Custom1, Custom3 (note a comma on the begin). I don't know your intention, maybe this is even preferable for you.
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

stutes
Posts: 101
Joined: Mon May 12, 2003 9:06 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by stutes » Mon Jun 29, 2009 10:12 am

All at once: very cool! Thanks so much for your help; for someone like me who is vbscript illiterate, this is VERY helpful!
Version: MediaMonkey 3.1.0.1236
Syncs iPod Touch 2nd Gen (firmware 2.2) and SD cards via card reader
(Touch also syncs with iTunes on a Mac, OS X 10.5, set manage podcasts, apps, photos, contacts & calendar, but NOT music)

mk1065
Posts: 6
Joined: Thu Feb 14, 2008 9:27 am
Contact:

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by mk1065 » Mon Jun 29, 2009 2:40 pm

Anyone know how I could put all my featured artists in paranthesis. For example:

Find what - ft. Easy E
Replace with - (ft. Easy E)

CarlitoGil
Posts: 294
Joined: Sun Sep 07, 2008 10:46 am
Location: Dominican Republic
Contact:

RegSub Help

Post by CarlitoGil » Mon Jun 29, 2009 2:52 pm

Code: Select all

RegSub(RegSub(RegSub(RegSub(RegSub(oSongData.Path,"\bI\b","1"),"\bII\b","2"),"\bIII\b","3"),"\bIV\b","4"),"\bV\b","5")
Is there a more efficient way to do this?
I may be using more substitutions
iTunesMonkey + Acoustid – Find metadata from iTunes and Acoustid

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

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by ZvezdanD » Mon Jun 29, 2009 3:53 pm

mk1065 wrote:Anyone know how I could put all my featured artists in paranthesis. For example:

Find what - ft. Easy E
Replace with - (ft. Easy E)
Find what:

Code: Select all

\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s.*[^)]$
Into: Artist
Regular expression 1: checked
Replace with:

Code: Select all

($&)
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

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

Re: RegSub Help

Post by ZvezdanD » Mon Jun 29, 2009 4:48 pm

GIL wrote:

Code: Select all

RegSub(RegSub(RegSub(RegSub(RegSub(oSongData.Path,"\bI\b","1"),"\bII\b","2"),"\bIII\b","3"),"\bIV\b","4"),"\bV\b","5")
Is there a more efficient way to do this?
I may be using more substitutions
Well, you could not simplify it too much. You could try with the MapArray function as it is in the "Fix common words (I'm, I'll, don't, won't, ain't, isn't, can't)" preset. For your example:
Find what:

Code: Select all

\b(?:(I)|(II)|(III)|(IV)|(V))\b
Replace with:

Code: Select all

MapArray(Array("$1", "1", "$2", "2", "$3", "3", "$4", "4", "$5", "5"))
However, there is a bug in the MapChr function, so you need to modify the source code of the script if you want to write numbers as a replacement. In the line 987 instead of:

Code: Select all

If IsNumeric(sDst) Then
you should write:

Code: Select all

If VarType(sDst) = vbInteger Then
The next version of the script would have somewhat simpler MapArrayEx function with which you could write the Replace with string directly, without specifying strings for replacement in the Find what field as it is in previous case. Here is its future use:

Code: Select all

MapArrayEx("$&", Array("\bI\b", "1", "\bII\b", "2", "\bIII\b", "3", "\bIV\b", "4", "\bV\b", "5"))
If you are interested for such syntax, I could publish the updated script with that function. By the way, you will have a problem with English word "I" with those replacements.
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

Big Isch
Posts: 112
Joined: Mon Mar 12, 2007 8:34 am
Location: Austria

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by Big Isch » Tue Jun 30, 2009 2:27 am

Suggestion for Grouping of Presets

This is really a great tool with lots of capability and lost of presets. Such, some sort of grouping for
presets comes to mind, as already discussed in this topic.

My suggestion is to add a text-field that functions as filter for the presets display in the listbox.
When this field is not-blank, then only Presets starting with the entered text are displayed.
The presets that are delivered with installation could begin with a special letter, e.g. "+" or "!"

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

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by nynaevelan » Tue Jun 30, 2009 8:30 am

Big Isch wrote:Suggestion for Grouping of Presets

This is really a great tool with lots of capability and lost of presets. Such, some sort of grouping for
presets comes to mind, as already discussed in this topic.

My suggestion is to add a text-field that functions as filter for the presets display in the listbox.
When this field is not-blank, then only Presets starting with the entered text are displayed.
The presets that are delivered with installation could begin with a special letter, e.g. "+" or "!"
As an organizational maniac I agree with this suggestion. :D

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

martialartsguy
Posts: 266
Joined: Mon Apr 03, 2006 9:11 am
Location: Denver, CO

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Post by martialartsguy » Tue Jun 30, 2009 11:51 am

Question here, and again I apologize for my lack of knowledge with regexp. I'd like to capitalize all the text (from: happy to: Happy) in all the following fields:

Tempo, Mood, Occasion, Quality

I use these a lot and sometimes forget to capitalize. I have presets set up for each one, but if I could run all four at once, that'd be excellent.
Each has the following setting:

Find What: ([\w\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF])([\w'\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*)
Replace with: UCase("$1") & LCase("$2")

Thanks for your help.
MM 4.1.10.1778

CarlitoGil
Posts: 294
Joined: Sun Sep 07, 2008 10:46 am
Location: Dominican Republic
Contact:

Re: RegSub Help

Post by CarlitoGil » Tue Jun 30, 2009 2:07 pm

The next version of the script would have somewhat simpler MapArrayEx function with which you could write the Replace with string directly, without specifying strings for replacement in the Find what field as it is in previous case. Here is its future use:

Code: Select all

MapArrayEx("$&", Array("\bI\b", "1", "\bII\b", "2", "\bIII\b", "3", "\bIV\b", "4", "\bV\b", "5"))
Thanks, That's what I need to modify from another fields than the one with the numbers
If you are interested for such syntax, I could publish the updated script with that function.
Yeah
Do you ever wish you could get the version 35.9 of this script from the year 2025?
By the way, you will have a problem with English word "I" with those replacements.
That's no problem, I'll be using this to detect Disc # from the path, so it would need to say "I" after the words (CD|Disc|Disk|Disco), you know.
iTunesMonkey + Acoustid – Find metadata from iTunes and Acoustid

Post Reply