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

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Hdhntr23
Posts: 106
Joined: Tue Nov 27, 2012 10:21 am

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

Post by Hdhntr23 »

so once Im done with the yellow edits on one page if I click on "find next" it wont automatically go to the next page?

Can you explain what "keep matched" and keep to replace, and all those button options mean in the lower right hand corner?
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

The pages don't change automatically (changes are made on all of them, though). I'm not sure about the "keep" stuff, as I don't use it.
I'm sure it is discussed in the Intro. "Replace" and "Replace all" are dependent on what tracks you have checked.
You should print out the intro and make highlights and notes of things for future reference.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

MMFrLife wrote:So, by an example, you'd need me to literally write out the entire path? You can't write it with a starting position signifier?
Yes, I needed the entire path as an example. For example, if I have:
c:\My Music\Rock\The Beatles\The Beatles [White Album]\Disc1\01 - Back in the U.S.S.R..mp3
I want to move prefixes only on the third level of sub-folders ("The Beatles" -> "Beatles, The"), but I don't want to apply it on the forth level ("The Beatles [White Album]" -> "Beatles [White Album], The").

The folders in the path have a starting position signifier which is "\", but it is same for every sub-level of folders, even for the fourth level which in my example represents the name of the album, so you cannot use it in general.

You need some specific preset which deals with the particular level of sub-folders. For example, there are several presets which manipulate the last (rightmost) sub-folder of the path, e.g. "Append weighted average Bitrate of album to the last folder of Path".

If you have some spare Custom field, you could use it as an intermediate storage for your need, using 3 presets one after another. The first two presets already exist: "Assign specified folder level of Path to <Into Field>..." and "Move prefixes to the end of <Into Field>..." specifying that Custom field in the Into combo box. The third preset is new and it would be the opposite of the first one:

Preset: Assign <From Field> to specified folder level of Path ...
Description: If specified value = 3, Beatles, The (specified field) and c:\My Music\Rock\The Beatles\Let It Be.mp3 (old Path) -> c:\My Music\Rock\Beatles, The\Let It Be.mp3 (new Path)
Find what: ^((?:[^\\]+?\\){<Number Caption="Folder level" Value="3">})([^\\]+)((?:\\[^\\]+){1,})
Into: Path
Regular expression 1: checked
Replace with: "$1" & <From Field> & "$3"
From: e.g. Custom 1
VBScript expression: checked

Of course, in case if you already have the artists in the form with the prefixes on the end stored in some field (e.g. Custom x), then you could skip first two mentioned presets and just use the third one.

Or, you could simply use just this preset:

Preset: Move prefixes to the end of specified folder level of Path...
Description: If specified value = 3, c:\My Music\Rock\The Beatles\Let It Be.mp3 -> c:\My Music\Rock\Beatles, The\Let It Be.mp3 (Path)
Find what: ^((?:[^\\]+?\\){<Number Caption="Folder level" Value="3">})([^\\]+)((?:\\[^\\]+){1,})
Into: Path
Regular expression 1: checked
Replace with: "$1" & RegSub("$2", "(^|;\s*)(The|A|An)(\s+)(.+?)(?=$|;\s*)", "$$1$$4,$$3$$2") & "$3"
VBScript expression: checked

Please be extremely careful when using this add-on with the Path specified as Into field (or any derived field as Folder, Filename and Extension)!
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
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

I tried the last (simplest) one and it worked brilliantly!
...and all that without knowing an exact path. You da man, Z! 8)
Big Thanks!
Last edited by MMFrLife on Fri May 29, 2015 6:32 am, edited 1 time in total.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
Hdhntr23
Posts: 106
Joined: Tue Nov 27, 2012 10:21 am

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

Post by Hdhntr23 »

Thanks to everyone thats answered my questions. I really appreciate it.

One thing Im noticing is that when I make a change to a song title (As I mentioned I am currently trying to capitalize every first letter of every word on 40K+ files) is that the text in the path doesnt change with the edits... Not a HUGE deal but Im wondering if it should?

I have read the first post and have it in a word doc that I have opened in as Im doing my edits but I still can not for the life of me figure out how to only show the files that are up to edit vs. ALL of my files. I think it has something to do with the check boxes on the left of the titles as well as one of those button options in the lower left "keep matched" etc...

Its KILLING me that I can't figure this part out. ANY help would be very much appreciated.
Hdhntr23
Posts: 106
Joined: Tue Nov 27, 2012 10:21 am

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

Post by Hdhntr23 »

Ok so for anyone else wondering how to get JUST the highlights to show this is how you do it...

Uncheck all of the check boxes on the upper left. Then on the lower right hand side, select "keep to replace".

The software then will query your dbase and bring back a list of the songs that have your list of edits in them.

Select all under edit then open find and replace and voila youll have your list with ONLY the yellow highlights!!

Hope this helps someone in the future!

If I could figure out how to post screenshots for you guys I would. I dont have a pic hosting site and this BBoard doesnt allow uploads of images that I can tell.
terrypin
Posts: 945
Joined: Mon May 10, 2004 7:48 am

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

Post by terrypin »

Hdhntr23 wrote:
If I could figure out how to post screenshots for you guys I would. I dont have a pic hosting site and this BBoard doesnt allow uploads of images that I can tell.
I'd recommend you get a free Dropbox account. It's easy to set up and use. Upload your screenshot to it, note the link, and paste it in full directly into your post here. Same for a video clip.
Terry, East Grinstead, UK
MM 5.0.2.2532 (Gold), i7 4.0 GHz running Win 10 Pro
MM 4.1.31.1919 (Gold)
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

Hdhntr23 wrote:Anyway, is there a preset to capitalize every first letter of each word in a field?
So, you wanted it for the song/title field, but you also want it for the track title in the path?
Changing the into field to filename doesn't work?
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
dtsig
Posts: 3588
Joined: Mon Jan 24, 2011 6:34 pm

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

Post by dtsig »

And if that doesn't work .. once you have your tags all set you could simply use Auto-Organize Files (Ctrl-R). Set up a mask and this will "rename" all the files (or should .. windows is funny about knowing there is a difference in file name 'This IS' and 'this is'). But with the correct mask it would simply go through and rename the files ..
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig
Hdhntr23
Posts: 106
Joined: Tue Nov 27, 2012 10:21 am

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

Post by Hdhntr23 »

Thanks!

I do have it set to actively "monitor" my dbase, so maybe after I do a restart of MM it'll rename those changed files.

If not, Ill set up a mask to rename the files.

You've been a big help I appreciate it.
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

How do I remove all of a certain character from a particular starting point in the path.

For ex., I want to remove all "-" (hyphens) starting at the 2nd folder (or any defined position = 1 or 2 or 3...), something like:
F:\Folder -1-\Folder -2-\-Folder- -3-\name1-name2.flac

So, all hyphens to the right of folder -1- would be removed.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
terrypin
Posts: 945
Joined: Mon May 10, 2004 7:48 am

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

Post by terrypin »

Until ZvezdanD comes along, maybe this will help. I consulted an online friend who's a RegEx guru (I know only the basics) and he reckons this regex expression will do it:

Find: (^(?:[^\\\n]*\\){2}.*?|\G.*?)-
Replace with: $1

I'm assuming:

1. His version of RegeEx (I think it's PERL) is the same as the add-on uses. (It's not the same as my aging text editor uses; that's a POSIX version.)
2. You know how to use the add-on UI to incorporate that. (I made a brief but unsuccessful attempt.)

P.S: That was for the string following the 2nd backslash; you'd adapt for 3rd, 4th, etc.
Terry, East Grinstead, UK
MM 5.0.2.2532 (Gold), i7 4.0 GHz running Win 10 Pro
MM 4.1.31.1919 (Gold)
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

I've only looked at it for one path example (with only 2 folders), but it appears to recognize only some character parts of a folder(s) in the path
and completely disregards the filename. If I choose 2, it takes care of the single hyphen in that folder string. But if I choose 1, it
eliminates only the first one of two hyphens in that folder string. ...seems close, though!

Thanks for your efforts. I appreciate you going out of your way. :)
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
terrypin
Posts: 945
Joined: Mon May 10, 2004 7:48 am

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

Post by terrypin »

I updated my text editor so that it now uses the same more powerful version of RegEx as my expert friend's.

If I now apply the expression

Find: (^(?:[^\\\n]*\\){2}.*?|\G.*?)-
Replace with: $1

...to these test strings (including your example)

F:\Folder -1-\Folder -2-\-Folder- -3-\name1-name2.flac
X:\abc-def\123-456\-xyz-789
C:\xyz-123\abc-456-\- 1- pq-\this-that-\-other\artist-album.mp3


I get this result, which looks as if it does what you want:

F:\Folder -1-\Folder 2\Folder 3\name1name2.flac
X:\abc-def\123456\xyz789
C:\xyz-123\abc456\ 1 pq\thisthat\other\artistalbum.mp3


So it sounds like the RegEx used by the add-on differs in syntax or functionality in some way.
Terry, East Grinstead, UK
MM 5.0.2.2532 (Gold), i7 4.0 GHz running Win 10 Pro
MM 4.1.31.1919 (Gold)
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

Preset: Remove specified string from <Into Field> after another specified string...
Description: Remove all "String to remove", but only after the first (leftmost) occurrence of another specified string
Find what: ^(.*?<String Caption="Remove after string" Value="\">)(.*)
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1))

Preset: Remove specified string from <Into Field> before another specified string...
Description: Remove all "String to remove", but only before the last (rightmost) occurrence of another specified string
Find what: (.*)(<String Caption="Remove before string" Value="\">.*?)$
Replace with: Replace("$1", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$2"

Preset: Remove specified string from <Into Field> after rightmost another specified string...
Description: Remove all "String to remove", but only after the last (rightmost) occurrence of another specified string
Find what: ^(.*<String Caption="Remove after string" Value="\">)(.*)
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1))

Preset: Remove specified string from <Into Field> before leftmost another specified string...
Description: Remove all "String to remove", but only before the first (leftmost) occurrence of another specified string
Find what: (.*?)(<String Caption="Remove before string" Value="\">.*)$
Replace with: Replace("$1", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$2"

Preset: Remove specified string from <Into Field> after specified occurrences of another specified string...
Description: Remove all "String to remove", but only after the specified number of occurrences of another specified string
Find what: ^((?:.*?<String Caption="Remove after string" Value="\">){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})(.*)
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1))

Preset: Remove specified string from <Into Field> before specified occurrences of another specified string...
Description: Remove all "String to remove", but only before the specified number of occurrences of another specified string
Find what: (.*)((?:<String Caption="Remove before string" Value="\">.*?){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})$
Replace with: Replace("$1", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$2"

Preset: Remove specified string from <Into Field> between two another specified strings...
Description: Remove all "String to remove", but only after the first (leftmost) occurrence of the first specified string and before the last (righmost) occurrence of the second specified string
Find what: ^(.*?<String Caption="Remove after string" Value="\">)(.*)(<String Caption="Remove before string" Value="\">.*?)$
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$3"

Preset: Remove specified string from <Into Field> between specified occurrences of another specified strings...
Description: Remove all "String to remove", but only after the specified number of occurrences of the first specified string and before the specified number of occurrences of the second specified string
Find what: ^((?:.*?<String Caption="Remove after string" Value="\">){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})(.*)((?:<String Caption="Remove before string" Value="\">.*?){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})$
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$3"

Regular expression 1 and VBScript expression: checked in all presets

By the way, the VBScript's RegEx engine used in this add-on doesn't support "\G".
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