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

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) [MM2+]

Post by MMFrLife »

Is there a preset that will enclose a string without
having to use two presets?

ex.

'enclose'
'enclose a string'
I want to 'enclose a string' with a preset

I enclosed the strings above with ' and '

It would be the opposite idea of "Strings inside brackets"
In this case you are dealing with the brackets/enclosures,
but you could specify them with whatever you wanted for an
enclosure.
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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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) [MM2+]

Post by ZvezdanD »

I don't understand what you want. Couldn't you use the first preset and replace enclose with 'enclose'?
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) [MM2+]

Post by MMFrLife »

ZvezdanD wrote: Thu Oct 28, 2021 2:07 am Couldn't you use the first preset and replace enclose with 'enclose'?
Say I want to enclose what is in the album field before I move it to another field
as part of a batch process, I don't want to have to copy an example of what is in the album field
first, so I can then input the example in the before and after fields of the replace preset.

I want to set up a preset that will just put the quote characters (or anything else) on each end of what is in the album
column. That way I don't have to worry about the info in a column changing and having to always copy
and paste. I did, however, incorrectly estimate the number of presets.

In case you are curious why I would "move" my album column. It has to do with how I organize my Best of, Hits, etc
type releases. Basically, I rename the album title to something else and keep the original name, with additional info, at the end of the song titles. A little more to it than that, but that's the nutshell.
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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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) [MM2+]

Post by ZvezdanD »

I am sorry but I still don't understand what is your final goal. If you want to move Album field to another field with added enclosing characters, why don't you use the "Move <From Field> to <Into Field>..." with specified Prefix and Suffix?
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) [MM2+]

Post by MMFrLife »

Sorry, I forgot to mention that there are two scenarios, where one isn't at the "very" end.
Partly because I wasn't exactly sure how to word it, but it is really more complex
to show exactly how I'm using it.

In a nutshell, I can't figure out a way to do what I want in less than 4 presets in a batch.
The problem is I would like to reduce it, at least, by one.

ex.

Album = Outer Space is Great [3D]

Title = 10 Planet Vibes [1_6]

Result:

Album = empty
Title = 10 Planet Vibes {from 'Outer Space is Great'; 2019; 3D} [1_6]

The first preset in the batch is,

Insert <From Field> to <Into Field> before specified string...
but the prefix-suffix settings aren't enough to get it done in this preset alone.
The ending single quote has to be applied in the second preset.

As I analyzed the situation further, I don't think an enclosures preset would make my batch more
efficient by reducing the number of presets to 3 instead of 4, anyway.

Oh well, don't worry about trying to understand, even though you are indeed capable.
A preset like that (enclosures) is, perhaps, not all that warranted by
most and it doesn't seem at this point like it's going to help me like I thought
it might. And again, even if something could be figured out, it would probably only ever be
able to reduce by a single preset.
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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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) [MM2+]

Post by ZvezdanD »

1st preset: replace [3D] with '; 2019; 3D (but I don't know from where you got that 2019);

2nd preset, you could use just one preset if your last part of title (" [1_6]") has:
- fixed number of characters (e.g. 6 in the mentioned example including space char):
Move <From Field> to <Into Field> before specified number of characters...

- fixed number of words:
Move <From Field> to <Into Field> before specified number of words...

- unique string, e.g. " [":
Move <From Field> to <Into Field> before specified string...

- fixed number of unique string:
Move <From Field> to <Into Field> before right-specified instance of specified string...

Every one of them has ability to add Prefix = "{from" and Suffix = "}".
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) [MM2+]

Post by MMFrLife »

ZvezdanD wrote: Thu Oct 28, 2021 3:40 pm 1st preset: replace [3D] with '; 2019; 3D (but I don't know from where you got that 2019)
The disc count [3D] and date "2019" are dynamic, not fixed.
The date is inserted over from the date field in the 4th preset of the batch.
I would have to go in and replace every time I worked on a set that had a different disc count, no?
And since the date has to be carried over, that is a second preset right there, no?

Batch contents:
#1. Insert <From Field> to <Into Field> before specified string... [copies album over & fixes/adds characters/adds partial descriptor ]
#2. Replace specified string with another one in <Into Field>... [fixes various characters/short strings and adds character(s)]
#3. Replace specified string with another one in <Into Field>... [fixes various characters/short strings]
#4. Insert <From Field> to <Into Field> before specified string... [copies over year]
...and yes, many are wonderfully 'prefix-suffix' capable. Seriously, I don't know how I got by
using it before you expanded them like that. :D

The way I have it works perfectly at the goal of getting the data displayed correctly.
It would be awesome if I am missing something and you could get it down to 2 or less,
only 'pretty good' if you can get it down to 3 (haha; I keed, I keed).

If you don't have a solution just yet and are really interested in seeing screenshots of the batch presets
at all stages of execution, I'm game; but give me a little time.
Last edited by MMFrLife on Tue Jan 11, 2022 1:58 am, edited 3 times 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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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) [MM2+]

Post by ZvezdanD »

Well, if your data is dynamic, I doubt it could be easily made with less than 4 presets. I mean, of course it could be done even with single preset, but it is not worth it wasting time since you already have the usable solution.
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) [MM2+]

Post by MMFrLife »

ZvezdanD wrote: Thu Oct 28, 2021 5:24 pm I mean, of course it could be done even with single preset, but it is not worth it wasting time since you already have the usable solution.
Yes, of course. The ole, sometimes too complex, single preset.

Initially, I did it a couple of different ways successfully, but only with the exact
same presets in same order. The second version just makes the changes a little
more clear as to what is going on.

It's all good. No worries.
Most importantly, thanks!
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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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"
😜
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) [MM2+]

Post by MMFrLife »

I've been looking all around for something like:

"Replace +/- specified position from right specified folder level".

I feel like I've done this, or something similar, a few times before; but here it is...

I have one character I want to change in a folder level of some paths numbering in the 100s-1000s.
The character pos. in focus is fixed, but the enclosing strings are dynamic.
I would prefer not to have to specify opening and closing strings, completing all the paths at the
same time.

Path examples,

\AMI.A3.T\T(UE) 0c Yellow Magic Orchestra (YMO)\A20_1978A Yellow Magic Orchestra\01 Computer Game 'Theme from the Circus'.mp3
\AMI.A2.S\S(UE) P-AMB_1a Stereolab\B20_1995A Switched on, Vol. 2- Refried Ectoplasm\08 Tone Burst (Country).flac
\AMI.A2.S\S(R) B_1c Rory Gallagher\B25_2019A Blues [3D]\07 Million Miles Away, A {BBC Radio 1; Bob Harris ses; 1973}.flac

I am targeting the first or only number '2' for around 500 hundred paths within the specified Folder Level

Something like:

Folder Level = 1
Find = 2nd pos. (not counting slash?)
Replace with = 3

This would be set to match and replace the following folder level 1, as follows, from each of the above paths

1st path

A20_1978A Yellow Magic Orchestra
to
A30_1978A Yellow Magic Orchestra

2nd path

B20_1995A Switched on, Vol. 2- Refried Ectoplasm
to
B30_1995A Switched on, Vol. 2- Refried Ectoplasm

3rd path

B25_2019A Blues [3D]
to
B35_2019A Blues [3D]
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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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) [MM2+]

Post by ZvezdanD »

MMFrLife wrote: Sat Jan 08, 2022 4:22 pm I've been looking all around for something like:

"Replace +/- specified position from right specified folder level".
Maybe you could try with the "Replace specified string with another one in <Into Field> before right-specified instance of another specified string..." using Before string = "\".

The another, more complex solution would be using a batch:
- copy a specified folder level to an empty custom field with "Assign right-specified folder level of Path to <Into Field>..."
- do any necessary modifications on that custom field;
- copy that custom field back to the specified folder level with "Assign <From Field> to right-specified folder level of Path...".
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) [MM2+]

Post by MMFrLife »

Ok, those two solutions are looking familiar.

The second solution is the only way, currently, it can be done for folder levels between beg and ending folder levels, right?

Thanks! 8)
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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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) [MM2+]

Post by ZvezdanD »

I don't know what you meant. Why don't you just try it?
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) [MM2+]

Post by MMFrLife »

MMFrLife wrote: Sun Jan 09, 2022 5:57 am The second solution is the only way, currently, it can be done for folder levels between beg and ending folder levels, right?
ZvezdanD wrote: Sun Jan 09, 2022 5:57 amI don't know what you meant. Why don't you just try it?
I tried the first one before I wrote that. I should have clarified.
It works great!

The second one I haven't tried and will get around to it at some point,
but I am confident it works. I am just wondering something about it
for the sake of curiosity/knowledge, only.

For the second one you start with the point: The other, more complex solution.....

I'm not sure if by the second one you mean the first solution will not accomplish the task, if the
folder level targeted is in between the beginning and ending folder levels, but the second one will.
Or, if the second one is just another possibility or alternative, albeit more complex.

In other words, is it correct to assume that, currently, the second one is the only
way to achieve a desired result if the folder level to be changed is "between" either
terminating folder level?

All I need is confirmation or denial, so I can rest assured I'm not missing something
with the simplicity of the first solution.

Thanks

EDIT: I don't mean to say: is it the 'only' way, currently?
I mean, is there no other simpler way? ...being ok with it if there is not.
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
Support the one and only - ZvezdanD! (the "originator" since 2006). Please take a moment to read the bottom of this webpage.
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) [MM2+]

Post by ZvezdanD »

MMFrLife wrote: Sun Jan 09, 2022 1:26 pm EDIT: I don't mean to say: is it the 'only' way, currently?
Well, you didn't say "is it the only way" but "is the only way". So, I concluded that the first way didn't work for you.

I still don't understand what you mean by beginning and ending folder levels. With both solutions you have a possibility to specify folder level, it doesn't matter if it is the first (beginning) or the last one.

Anyway, the first solution is simpler because it involves just one preset. However, I think you will have problem with that preset because you want to replace the leftmost occurrence of a character, but it replaces the specified number of rightmost matches. So, I am not sure if it could work for you, which is why I suggested that you try it.

For example, it will work fine if you want to replace "2" with "3" in "A20_1978A Yellow Magic Orchestra" because there is only one "2" in it, but you will have a problem if you have something like this: "A20_2022A Yellow Magic Orchestra".

If you use another preset with "after left-specified instance" in name, it will find/replace the leftmost occurrences, but with that preset you are specifying folder levels from the left, not right.

With the second solution you could use any presets for replacement of characters, leftmost or rightmost, independently of the direction of folder level counts. For example, "Replace specified string with another one in <Into Field> after specified number of characters..." for replacements of the leftmost occurrences, using Num. of chars. to skip = 0 and Num. of replacements = 1.
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