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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

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

Postby TRegina » Fri Oct 20, 2017 10:21 pm

Hello,

Is there some expression I can insert into the Capitalize preset that will keep Irish names that begin with "McC****" intact and not turn them into "Mcc***"?

Thanks.
TRegina
 
Posts: 5
Joined: Thu Oct 27, 2016 8:52 pm

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

Postby mhendu » Mon Oct 23, 2017 10:33 pm

I use Custom5 to store the AcoustID from Musicbrainz, and every so often I get a new version of the same track - I'd like to copy the genre and date from the older file to the newer file, without having to dig through my database to find the duplicates. I'm using a modified version of one of the presets of this script to try to source the year and copy that over but I'm no SQL or regular expressions expert so I couldn't figure out how to copy the entire date (in those cases where the database has mm/dd/yyyy), and currently my query below returns eight characters for the year instead of just the expected four (e.g., 19650000). Any help to fix these issues would be appreciated - my workaround is to copy the year to another field for now, then to copy that over less the four ending characters, but would prefer to just copy the date directly.

IfNull(SQLQuery("SELECT Year AS SortField FROM Songs WHERE Custom5 = '" & Replace(oSongData.Custom5, "'", "''") & "' AND Year <> '' GROUP BY Year ORDER BY SortField DESC"), "$&")
mhendu
 
Posts: 79
Joined: Thu Jan 12, 2006 11:18 am

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

Postby MMFrLife » Tue Oct 24, 2017 4:41 am

TRegina wrote:Is there some expression I can insert into the Capitalize preset that will keep Irish names that begin with "McC****" intact and not turn them into "Mcc****?


I'm not sure about an expression, as the letters and positions may vary from name to name. You can just enter some of the Irish names that you
are concerned with to the "other" exceptions field (in whole; McCullers, etc.).
Last edited by MMFrLife on Tue Oct 24, 2017 9:04 am, edited 5 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]
MMFrLife
 
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

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

Postby ZvezdanD » Tue Oct 24, 2017 9:02 am

mhendu wrote:I'm using a modified version of one of the presets of this script to try to source the year and copy that over but I'm no SQL or regular expressions expert

If you are using a modified version, then I suppose you know at least VBScript. You could use Left(..., 4) to get the leftmost 4 characters of any string.
Magic Nodes 4.3.2/5.1 RegExp Find & Replace 4.4.8/5.1  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1/5.3.6  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: 3020
Joined: Thu Jun 08, 2006 7:40 pm

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

Postby ZvezdanD » Tue Oct 24, 2017 9:07 am

MMFrLife wrote:
TRegina wrote:Is there some expression I can insert into the Capitalize preset that will keep Irish names that begin with "McC****" intact and not turn them into "Mcc****?


I'm not sure about an expression, as the letters and positions may vary from name to name. You can just enter some of the Irish names that you
are concerned with to the "other" exceptions field (in whole; McCullers, etc.).

Are you finished with the editing of that post? :)

If you tried the preset updated in v5.1, you would know that it has Prefixes tag with Mc and O' already predefined.
Magic Nodes 4.3.2/5.1 RegExp Find & Replace 4.4.8/5.1  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1/5.3.6  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: 3020
Joined: Thu Jun 08, 2006 7:40 pm

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

Postby mhendu » Tue Oct 24, 2017 7:04 pm

ZvezdanD wrote:
mhendu wrote:I'm using a modified version of one of the presets of this script to try to source the year and copy that over but I'm no SQL or regular expressions expert

If you are using a modified version, then I suppose you know at least VBScript. You could use Left(..., 4) to get the leftmost 4 characters of any string.


Thanks. I have no idea what I'm doing but I managed to figure that out. Just added Left(...,4) around the VBScript that I'd posted in my earlier post and it worked perfectly. Thank you.

I've also been adding the Musicbrainz Work ID to my tracks and created a code to look this up from Custom4 and pull in the oldest year associated with a given Work ID. Since many of my tracks have a blank Work ID I had to add in a filter to only show those tracks where Custom4 was not empty. This is helpful to get the composition year for classical music from an existing track in my library of that same composition.

LEFT(IfNull(SQLQuery("SELECT Year AS SortField FROM Songs WHERE Custom4 = '" & Replace(oSongData.Custom4, "'", "''") & "' AND Year > 0 AND Custom4 <> '' GROUP BY Year ORDER BY SortField"), "$&"),4)
mhendu
 
Posts: 79
Joined: Thu Jan 12, 2006 11:18 am

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

Postby MMFrLife » Sat Nov 11, 2017 4:26 am

I'm using "Auto-increment Track number with specified starting value and leading zero(es)...". I have it set from Entire to End of Into field.
Is there a way to insert a space before it, using that same preset (without batching something to it)?
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]
MMFrLife
 
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

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

Postby ZvezdanD » Sat Nov 11, 2017 4:26 pm

MMFrLife wrote:Is there a way to insert a space before it, using that same preset (without batching something to it)?

Add " " & at the begin of the Replace with string.
Magic Nodes 4.3.2/5.1 RegExp Find & Replace 4.4.8/5.1  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1/5.3.6  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: 3020
Joined: Thu Jun 08, 2006 7:40 pm

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

Postby MMFrLife » Wed Nov 15, 2017 2:26 pm

Thanks, those are the elements I was trying to find/insert somewhere. I just couldn't get them exact :( , but now :D .

Similar to the above example:

If I use "Copy <From Field> to <Into Field>..." and set Entire to Begin, how would I insert
a space between the beg. string and the original string?
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]
MMFrLife
 
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

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

Postby ZvezdanD » Wed Nov 15, 2017 5:14 pm

MMFrLife wrote:If I use "Copy <From Field> to <Into Field>..." and set Entire to Begin, how would I insert
a space between the beg. string and the original string?

Which version of the preset are you using? The latest one has tags that allow appending to the begin/end with specified separator without need to modify Find what or Replace with strings directly.

Image
Magic Nodes 4.3.2/5.1 RegExp Find & Replace 4.4.8/5.1  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1/5.3.6  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: 3020
Joined: Thu Jun 08, 2006 7:40 pm

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

Postby MMFrLife » Wed Nov 15, 2017 7:25 pm

Yes, I figured out the problem. I used that preset from an older one before many of the parameters were consolidated".
Although, sometimes I just forget to use the tuner. When I first learned it, I use to do almost everything directly
and just kept doing it that way. I'm better now, but that habit still haunts me on occasion.

Thanks!
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]
MMFrLife
 
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

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

Postby MMFrLife » Wed Nov 15, 2017 8:49 pm

Ok, so I updated to the proper one (with the exact same tuner display as shown above) and noticed that when I
use Append - to begin it does it to the end, and Append - to the end puts it at the begin.
If I use Assign, then change Entire to begin, it basically works but no space.

Is the code accidentally flipped or something. I tried it on different non-numerical fields and got the same flipped results.
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]
MMFrLife
 
Posts: 2774
Joined: Fri Oct 26, 2012 9:04 pm

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

Postby ZvezdanD » Thu Nov 16, 2017 4:44 am

You are right, it was flipped. Thanks for the report. Here is the fixed Replace with string:
<If Caption="Assign to the field" Value=1 ID=1><From Field><Else Caption="Append to:"><If Caption="the begin of field" Value=1 ID=2><From Field><Else Caption="the end of field">"$_"<End If> & IIf(Len("$_") > 0 And Len(<From Field>) > 0, "<String Caption="Separator" Value=" - " ID=3>", "") & <If ID:2>"$_"<Else><From Field><End If><End If>

You don't need to (actually, you shouldn't) use the Entire/Begin button with the mentioned preset. That button is an extension of the Full button from the freely available version with added some new options. It doesn't represent any preset's parameter/option and its state is not saved with the preset. It is just a short way to insert to/replace Find what or Replace with string with some predefined pattern, e.g. with the Entire item you will get "^.*" which is the Regex replacement for the full content of the field. The mentioned preset has that thing already defined in the Find what and Replace with strings, it is enough to customize it using the Tune dialog box.

By the way, it is always recommended that you use the presets supplied with the latest version of the add-on using a guide mentioned in the Installation section, because many preset could be updated/improved, which is a fact that I mentioned in the What Is New section.
Magic Nodes 4.3.2/5.1 RegExp Find & Replace 4.4.8/5.1  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1/5.3.6  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: 3020
Joined: Thu Jun 08, 2006 7:40 pm

Previous

Return to Need Help with Addons?

Who is online

Users browsing this forum: Bing [Bot] and 15 guests