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

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 »

Shokri4971@gmail.com wrote:how can I edit the code to has this possibility to find and replace in multiple field, for example search in Artist and Album field
In general, this add-on allows find/replace in single field specified with the Into combo box. It is possible to use single preset to find/replace something in multiple fields, but it require good knowledge of VBScript and there is not universal approach to different requests. The "Swap <From Field> and <Into Field>" preset is an example how it is possible to use single preset to modify multiple fields (two in this example).

The another way to find/replace multiple fields using single preset could be done using the "All text fields" item in the Into combo box, but it is limited only to the same search and replacement strings. You could specify which text fields you want to modify using settings in the Search sheet of the Options dialog box [MM3.1+], but you should be very careful with that option, especially if you have specified the Path field.

The donation-only version has a third way to find/replace multiple fields at once using batches, i.e. several presets that modify different fields could be applied automatically in sequence.
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
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:I'm trying to add a string to the beginning of a folder level in the path.
1. way, using batch and some temporary field, e.g. Custom1:
- Assign left(or right)-specified folder level of Path to <Into Field>
- Append specified string to the begin of <Into Field>
- Assign <From Field> to left(or right)-specified folder level of Path

2. way, using "Replace specified string with another one in <Into Field> after left(or right)-specified instance of another specified string" preset, "String to replace" and "After string" should be "\", "Replace with" should be "\whatever_you_want_to_add".

EDIT: Here is the updated Replace with string with one new parameter, Num. of replacements which should be = 1in your case, left-specified:

Code: Select all

"$1" & Replace("$2", "<String Caption="String to replace" Value="\">", "<String Caption="Replace with" Value="\whatever_you_want_to_add">", 1, <Number Caption="Num. of replacements (-1 for all)" Value="1" MinValue="-1">, IIf(bMatchCase, 0, 1))
and right-specified:

Code: Select all

StrReverse(Replace(StrReverse("$1"), StrReverse("<String Caption="String to replace" Value="\">"), StrReverse("<String Caption="Replace with" Value="\whatever_you_want_to_add">"), 1, <Number Caption="Num. of replacements (-1 for all)" Value="1" MinValue="-1">, IIf(bMatchCase, 0, 1))) & "$2"
MMFrLife wrote:Also, is there a way to choose any "<From Field> to <Into Field>" preset and
manipulate a control(s) to limit it to just the "<Into Field>"
I am not sure that understand what you want.
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 »

Thanks!

#2 - single, That's what I'm looking for. ["before right-specified" version]

"Replace specified string with another one in <Into Field> before right-specified instance of another specified string..."

#1 - batch, I tried it for the heck of it and it basically works except it needs a 4th preset (clear field)
to clean up the temp field.

Anyway, I'm trying to avoid batches at this point (unless absolutely necessary).
My editing process is a very beautiful thing now, but it consists of many batches. I'm trying not to
add too many more. Although, since this is for a specific corrective purpose, there is the possibility to add
it until I've finished using, then save it to it's own INI for importing back in the future, if needed. But still,
why do that if not necessary. Also, a single is tunable for when the string changes, and I'm mainly variating between 2 different
strings.

Auto-Organize also works really well for this, but I like the power of being able to isolate "specific functions" to toolbar button/tune
rather than clogging up Auto-org's dropdown menu and having to sift through it after executing for many different things.

On the new functionality, "Number of Replacements", can you show me how the following path would change after applying it:

1. path = "Z:\FL1\FL2\FL3\01 This is a Really Great Song.mp3"
2. apply string "A0_" to r-spec. FL1 with "1" number of replacements, results in "Z:\FL1\FL2\A0_FL3\01 This is a Really Great Song.mp3"
3. apply "2" number of replacements results in "copy path with replacements here"?


Nevermind on the other issue. It was related to trying to find something for the above issue.
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:On the new functionality, "Number of Replacements", can you show me how the following path would change after applying it:
If Original is "Z:\FL1\FL2\FL3\01 This is a Really Great Song.mp3", "String to replace" and "Before string" are "\", "Replace with" is "\A0_" and Instance number=0:
Num. of replacements=1: Z:\FL1\FL2\FL3\A0_01 This is a Really Great Song.mp3
Num. of replacements=2: Z:\FL1\FL2\A0_FL3\A0_01 This is a Really Great Song.mp3
Num. of replacements=3: Z:\FL1\A0_FL2\A0_FL3\A0_01 This is a Really Great Song.mp3
Num. of replacements=4 or -1: Z:\A0_FL1\A0_FL2\A0_FL3\A0_01 This is a Really Great Song.mp3

Instance number=1:
Num. of replacements=1: Z:\FL1\FL2\A0_FL3\01 This is a Really Great Song.mp3
Num. of replacements=2: Z:\FL1\A0_FL2\A0_FL3\01 This is a Really Great Song.mp3
Num. of replacements=3 or -1: Z:\A0_FL1\A0_FL2\A0_FL3\01 This is a Really Great Song.mp3

Instance number=2:
Num. of replacements=1: Z:\FL1\A0_FL2\FL3\01 This is a Really Great Song.mp3
Num. of replacements=2 or -1: Z:\A0_FL1\A0_FL2\FL3\01 This is a Really Great Song.mp3

Instance number=3:
Num. of replacements=1 or -1: Z:\A0_FL1\FL2\FL3\01 This is a Really Great Song.mp3
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 »

Excellent! (maniacal laughter :lol: )

Thanks again
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"
😜
beg
Posts: 193
Joined: Wed Feb 04, 2009 12:36 pm

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

Post by beg »

Hi,

is there a way (I am quite sure there is, because regexp can do almost anything..) to find invisible carrier returns in tagging fields where they are not supposed to be and delete them?

I run into this issue sometimes when copy/paste information from excel sheets or webpages into tagging fields. If it's not the comment field, but single line field characters like carrier returns are invisible.

probably there is a way, I just have no idea of how to look for invisible carrier returns within given fields..

thx,
Bernhard
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 »

beg wrote:is there a way to find invisible carrier returns in tagging fields where they are not supposed to be and delete them?
Find what: \r?\n
RegExp 1: checked
Replace with: empty
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
beg
Posts: 193
Joined: Wed Feb 04, 2009 12:36 pm

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

Post by beg »

thx a lot!
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: Show files that do not have specified string at the end of <Into Field>...
Find what: ^(?!.*<String Caption="Ending string" Value="Live">$).*

Preset: Show files that have specified string at the end of <Into Field>...
Find what: (?=<String Caption="Ending string" Value="Live">$).*

Preset: Show files that do not have specified string at the begin of <Into Field>...
Find what: ^(?!<String Caption="Starting string" Value="The">).*

Preset: Show files that have specified string at the begin of <Into Field>...
Find what: (?=^<String Caption="Starting string" Value="The">).*

RegExp (F): checked
Replace with: $&
Action: Keep files with matched tags
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 »

Thanks!

I take it that when you write "RegExp 1", it means "RegExp (F):"?
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:I take it that when you write "RegExp 1", it means "RegExp (F):"?
Generally, yes. It is RegExp 1 in the freely available version, but it is later renamed.
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 »

Good to know :)
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"
😜
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 been using this preset for some editing,
"Copy rightmost part of <From Field> between specified strings to <Into Field>..."

It works well, but just a quick side note before my main question related to it -
I noticed that it doesn't copy "over" what's in the field it's copying to. It appends it
to the end of that field (which is what I want), but the wording of the preset name doesn't
mention that. Is that behavior expected and is it necessary to be mentioned in the name, no?

Even so, it works well, but here is what I'm really looking for,
something like "Move rightmost part of <From Field> between specified strings to <Into Field>..."
.
Same principle, just "move" instead of "copy" (again, to the "end of" new field). The problem
with the copy version is it leaves behind what I'm copying when I would like it to be removed from
the original field.

I would prefer not having to batch, but even if I did, I can't find anything else that could be batched
with the "Copy..." version (no "Remove..." or "Keep..." type presets will work, as it is a group of albums with
a varying number of strings, words, characters).

I'm sure I'm just missing something. I've probably already stared right at it.
Help me Obi-Wan!
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:I noticed that it doesn't copy "over" what's in the field it's copying to. It appends it
to the end of that field (which is what I want), but the wording of the preset name doesn't
mention that. Is that behavior expected and is it necessary to be mentioned in the name, no?
Like many other "Copy" presets, that preset replaces two old ones: "Assign ..." and "Append ...". You could choose the behavior, and hence the result of preset, using two radio buttons: "Assign to the field" and "Append to the end of destination field". If you have any suggestion about wording, please let me know.
MMFrLife wrote:something like "Move rightmost part of <From Field> between specified strings to <Into Field>...".
...
I can't find anything else that could be batched
with the "Copy..." version (no "Remove..." or "Keep..." type presets will work, as it is a group of albums with
a varying number of strings, words, characters).
I don't understand. Why you cannot use "Remove rightmost part of <Into Field> between (and including) specified strings" batched after the mentioned "Copy" preset?
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 »

Ah! I've been using the "copy" one from the preset settings dialog only.
That kept me from seeing the radio buttons. I usually use presets a little from that dialog first
before committing to using from the toolbar menu or a tool bar button.

I just glanced over the "remove" one before, but after seeing it closely now, it appears to be the one
to pair with.

Just to clarify, the "copy" preset uses "open/close" strings and no separator when destination
field is empty? It uses "open/close" strings and separator when destination field is not empty?

Anyway, now that I understand about the choice, I believe there may be a bug.
If a field has nothing in it and you execute the preset as default, it copies/assigns to the field.
But if you execute as default with something already in the field, it apppends the new string.
Doesn't sound like the typical bug, as it sounds great on the surface. But
it's taking away the option to overwrite if somethig is already in the field, no?

To test, do two consecutive executions of the preset to the same field without making any changes.
Or, did you already test before posting?
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"
😜
Post Reply