Page 92 of 108

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

Posted: Mon Jul 03, 2017 1:27 pm
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.

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

Posted: Mon Jul 03, 2017 1:53 pm
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.

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

Posted: Tue Jul 04, 2017 1:33 pm
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.

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

Posted: Tue Jul 04, 2017 5:06 pm
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

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

Posted: Tue Jul 04, 2017 6:27 pm
by MMFrLife
Excellent! (maniacal laughter :lol: )

Thanks again

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

Posted: Sun Jul 09, 2017 7:46 pm
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

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

Posted: Mon Jul 10, 2017 12:57 am
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

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

Posted: Mon Jul 10, 2017 3:18 pm
by beg
thx a lot!

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

Posted: Fri Jul 14, 2017 8:53 am
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

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

Posted: Fri Jul 14, 2017 10:12 am
by MMFrLife
Thanks!

I take it that when you write "RegExp 1", it means "RegExp (F):"?

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

Posted: Fri Jul 14, 2017 10:21 am
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.

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

Posted: Fri Jul 14, 2017 12:27 pm
by MMFrLife
Good to know :)

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

Posted: Sun Jul 16, 2017 6:48 pm
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!

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

Posted: Mon Jul 17, 2017 1:46 am
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?

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

Posted: Wed Jul 19, 2017 6:25 am
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?