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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Vexa
Posts: 2
Joined: Thu Aug 20, 2015 6:50 pm

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

Post by Vexa » Sat Aug 22, 2015 1:48 pm

Hello everyone. I have done some searching and found that someone had requested this before but I never saw any responses to it. I struggled my way through a few online RegEx courses but am still a bit lost as my expressions are not working in a flash based checker.

I am trying to create an expression to match songs with the producer listed at the end of the song title and to move it to Composer. I looked for an actual Producer metadata slot but couldn't find one so I was just going to use that.

And.. I'm completely lost.

It doesn't matter what it starts with so I can do a '.+' to start with right? And then I just need to match the '((|[)Prod.+' piece right? Because it can either be '(' or '[', and it can say 'Producer' or 'Prod' or 'Prod.'

But then I need to capture the text after 'By ' and move it to the Composer portion of the metadata and then delete the whole piece of it from the song title..

And that's the part where I am totally and completely lost. I don't even know where to start with that portion so I'm not sure what to even look up. All I know is to use brackets () for capture groups after matching the 'By ' string but.. yeah.

Can anyone help me create something to perform this function or even quickly write one up for me? I'd prefer if someone could walk me through it as RegEx are pretty interesting but again, I am in totally over my head.

MMFrLife
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

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

Post by MMFrLife » Sat Aug 22, 2015 2:17 pm

Vexa wrote:I am trying to create an expression to match songs with the producer listed at the end of the song title and to move it to Composer.
You want to copy the producer from the end of your song titles (because it's already there) and move or copy them into composer?
Or, you want to copy producer to both the end of the song title and the composer?
MM user since 2003 (lifetime since 2012) "Trying to imagine life without music gives me a headache"
track properties; dir/fn mask configurations; check out ZvezdanD's scripts
MMW 4.1.18.1842b; fav scripts > RegExp Find & Replace 5.1.0; Magic Nodes 5.1.0; Advanced Duplicate Find & Fix 3.8.2;
Backup 6.0; Clear Now Playing Button 1.2
...always back it up, especially before doing anything major!!!
Win. explorer alt. for power users [free]; great file/folder renamer [used by nasa]

Vexa
Posts: 2
Joined: Thu Aug 20, 2015 6:50 pm

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

Post by Vexa » Sat Aug 22, 2015 2:23 pm

Here I will provide some examples.

In my library I currently have:

1. Halo (Letter From My Unborn Son) (Feat. Heaven & Harmony) [Prod. By Street Symphony & 808xElite]
2. Hustle Hard (Prod. by Lex Luger)
3. Get Back Up Ft. Chris Brown (Produced By The Neptunes)

And I want the titles to be

1. Halo (Letter From My Unborn Son) (Feat. Heaven & Harmony)
2. Hustle Hard
3. Get Back Up Ft. Chris Brown

With the Producer data put into the Composer metadata position. Does that make a bit more sense? There are parentheses and brackets, some say producer and some say prod, with or without a period, and some have 'by' vs 'By'.

EDIT : A spin on a similar action would be to take the Featuring Feat. or Feat (Artist) and move that from the Artist metadata and suffix it to the song title. However I believe this function is already a preset in the plugin (?). I just was made aware of this add-on today so still learning a lot.

MMFrLife
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

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

Post by MMFrLife » Sat Aug 22, 2015 2:57 pm

First off, there is a Producer column. It's just under the Director in the "Into" drop down menu.

I don't think this can be accomplished with a single pre-existing preset. Maybe with a combination.
For a single maneuver, you'd need something like remove a certain number of words (1) from the end of the "From" field but copy (via move) it
to the Into field
or vice versa. Removing first as a separate step would be disastrous.

The feat. artist example is problematic because in this case the string for the producer isn't uniform.

I would be interested in seeing a response to this myself. I wouldn't know how to create a new preset for it.
Last edited by MMFrLife on Sun Aug 23, 2015 11:28 am, edited 4 times in total.
MM user since 2003 (lifetime since 2012) "Trying to imagine life without music gives me a headache"
track properties; dir/fn mask configurations; check out ZvezdanD's scripts
MMW 4.1.18.1842b; fav scripts > RegExp Find & Replace 5.1.0; Magic Nodes 5.1.0; Advanced Duplicate Find & Fix 3.8.2;
Backup 6.0; Clear Now Playing Button 1.2
...always back it up, especially before doing anything major!!!
Win. explorer alt. for power users [free]; great file/folder renamer [used by nasa]

Haaden2
Posts: 20
Joined: Thu Sep 09, 2010 12:03 pm

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

Post by Haaden2 » Sun Aug 23, 2015 8:00 am

ZvezdanD wrote:
Haaden2 wrote:Getting "Expression Error!" using Preset 155 Remove duplicate items in multi-item <Into Field>....
I cannot try it right now, so let me know if this works:

Code: Select all

Preset155=Name: "Remove duplicate items in multi-item <Into Field>...", Description: "Rock; Prog-Rock; Rock; Art Rock -> Rock; Prog-Rock; Art Rock", Shortcut: "", Icon: "", Toolbar: 0, FindWhat: "^.*", FindInto: "Genre", FindRegExp: 1, WholeWord: 0, ReplaceWith: "Execute(""Dim aItems, bMatch, sField, iItem, jItem: aItems = Split(Replace(sBefore, """"; """", """";""""), """";""""): For iItem = 0 To UBound(aItems): bMatch = False: For jItem = 0 To iItem - 1: If aItems(jItem) = aItems(iItem) Then bMatch = True: Exit For: End If: Next: If Not bMatch Then sField = sField & aItems(iItem) & """"; """": End If: Next: If Len(sField) Then sField = Left(sField, Len(sField) - 2) End If: SetVar 0, sField"") & GetVar(0)", ReplaceFrom: "Title", ReplaceRegExp: 0, ReplaceVBScr: 1, MatchCase: 0
Unfortunately this doesn't work - it wipes the field clean regardless of duplicate or not. May I ask for further assistance? I have been trying to solve this myself but have only succeeded in getting completely confused and frustrated.

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

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

Post by ZvezdanD » Sun Aug 23, 2015 8:27 am

Haaden2 wrote:Unfortunately this doesn't work - it wipes the field clean regardless of duplicate or not.
There is a new release of the add-on with that preset fixed.
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: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [M

Post by ZvezdanD » Sun Aug 23, 2015 10:51 am

Preset: Assign [(prefix string)] from <From Field> to <Into Field>...
Description: If specified prefix is "feat.", Something [feat. Artist1, Artist2] or Something (feat. Artist1, Artist2) (From Field) -> Artist1, Artist2 (Into Field)
Find what: ^.*
Regular expression 1: checked
Replace with: RegExpEx(<From Field>, "([([](?:<String Caption="Prefix text (RegEx)" Value="ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents">)\s+)([^\]\)]+)", 0, 1)
VBScript expression: checked

Preset: Remove [(prefix string]) from <Into Field>...
Description: If specified prefix is "feat.", Something [feat. Artist1, Artist2] or Something (feat. Artist1, Artist2) -> Something
Find what: ^.*
Regular expression 1: checked
Replace with: RegSub("$&", "\s+[([](?:<String Caption="Prefix text (RegEx)" Value="ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents">)\s[^\])]+?[\])]", "")
VBScript expression: checked

The prefix text could be any regular expression, e.g. "Prod(?:uced|\.)? By" instead of "ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents". By the way, all existing predefined presets for featuring artists have that regular expression, i.e. they cover almost all kind of feat. type (ft with or without dot, feat with or without dot and so on) and of course that string is not uniform.
Last edited by ZvezdanD on Mon Aug 24, 2015 11:06 am, edited 2 times in total.
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

Haaden2
Posts: 20
Joined: Thu Sep 09, 2010 12:03 pm

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

Post by Haaden2 » Sun Aug 23, 2015 12:26 pm

ZvezdanD wrote:There is a new release of the add-on with that preset fixed.
Not Found
The requested URL /~zvezdand/RegExpReplace-4.4.0.1.mmip was not found on this server.

I really don't mean to be a pain in the ass. You have great add-ons and support them very well!

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

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

Post by ZvezdanD » Sun Aug 23, 2015 12:32 pm

Haaden2 wrote:Not Found
The requested URL /~zvezdand/RegExpReplace-4.4.0.1.mmip was not found on this server.
It is 4.4.0.2 now. Did you try to refresh its Web page?
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

Haaden2
Posts: 20
Joined: Thu Sep 09, 2010 12:03 pm

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

Post by Haaden2 » Sun Aug 23, 2015 1:25 pm

ZvezdanD wrote:It is 4.4.0.2 now. Did you try to refresh its Web page?
OK, got it now. Preset appears to be working perfectly. Went to your download page and gladly made a donation for this great add-on and your great support of it. Thank you very much!

NWDreamer
Posts: 103
Joined: Fri Aug 24, 2012 4:12 am

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

Post by NWDreamer » Tue Aug 25, 2015 2:18 am

Ok, I've got a weird (and annoying) one... I've been using the "Auto-increment Track number with specified starting value" preset for awhile and it's worked fine (but always with a starting value of 1). I had one large album where the first two songs were fine so I selected the rest and set the starting value to 3. Instead of changing the track number field, it put the track number into the Title field instead, obviously wiping out all the titles... A couple more tries and it still didn't work so I fixed that album manually and didn't think about it until now when I went to add track numbers to an entire album so I set the starting value back to 1 and, again, it put all the track numbers into the Title field; wiping out the titles that were there...

Now it doesn't seem to want to work correctly no matter what I do and I'm REALLY tired of having to re-enter song titles! Any idea what caused this and how I can fix it? I was using that preset quite a bit prior to this.

Thanks,

Craig
Craig B. (a.k.a., NW Dreamer - Gold MediaMonkey user.)

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

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

Post by ZvezdanD » Tue Aug 25, 2015 3:08 am

NWDreamer wrote:Any idea what caused this and how I can fix it?
Most probably you have modified that preset changing Into field from Track # to Title. If you haven't, please post the screenshot of the RegExp Find & Replace dialog box with the mentioned preset selected.
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

NWDreamer
Posts: 103
Joined: Fri Aug 24, 2012 4:12 am

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

Post by NWDreamer » Wed Aug 26, 2015 12:51 am

Your comment had me dig into things a bit (since I just started using your addon, I had forgotten to look at the preset options and code). I found that the Auto-Increment preset was now looking at the Title field (as expected) instead of the Track # field for both input & output. I changed these back to Track # and confirmed that the preset worked again. Going farther, here's what I've found out: Changing the starting number alters the preset to use the Title field for both input and output (i.e., without my doing anything other than changing the starting number in the dialog). Below are five screenshots with notations that show this behavior. The first three show a corrected preset and, also, correct operation when using a starting number of 1. The last two show what happens when you change the starting number to 3. Since the screenshots are large, I'm only including links.

http://www.nwdreamer.com/pics/MediaMonk ... reen-1.jpg

http://www.nwdreamer.com/pics/MediaMonk ... reen-2.jpg

http://www.nwdreamer.com/pics/MediaMonk ... reen-3.jpg

http://www.nwdreamer.com/pics/MediaMonk ... reen-4.jpg

http://www.nwdreamer.com/pics/MediaMonk ... reen-5.jpg

In Extensions it says I'm using v4.4.0.1 of your script. I'm also using MM v4.1.8.1751 Portable Mode. If you don't get the same results, let me know what you'd like me to check or try.

Craig
Craig B. (a.k.a., NW Dreamer - Gold MediaMonkey user.)

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

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

Post by ZvezdanD » Wed Aug 26, 2015 5:24 am

NWDreamer wrote:In Extensions it says I'm using v4.4.0.1 of your script.
I have fixed the mentioned problem in v4.4.1. Thank you for the report.
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

NWDreamer
Posts: 103
Joined: Fri Aug 24, 2012 4:12 am

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

Post by NWDreamer » Wed Aug 26, 2015 6:46 am

Great! Nice to see any addon author being as on top of things too! :D
Craig B. (a.k.a., NW Dreamer - Gold MediaMonkey user.)

Post Reply