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

Post a reply

Visual Confirmation

To prevent automated access and spam, you are required to confirm that you are human. Please place a check mark next to all images of monkeys or apes. If you cannot see any images, please contact the Board Administrator.

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

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

Post by ZvezdanD » Thu Mar 23, 2017 5:53 am

v5.x Preset: Assign merged Comment from all tracks on Album to <Into Field>...
Description: If Separator is "; ", track#1 has Comment="String1", track#2 has Comment="String2" and track#3 has Comment="String3" -> destination field for all tracks="String1; String2; String3"
Find what: ^.*
RegExp1: checked
Replace with: SQLQuery("SELECT group_concat(F1, '<String Caption="Separator" Value="; " ID=1>') FROM (SELECT DISTINCT Comment AS F1 FROM Songs AS S1 WHERE IDAlbum = " & oSongData.Album.ID & " AND Comment <> '' AND InStr('<ID:1>' || (SELECT group_concat(F2, '<ID:1>') FROM (SELECT DISTINCT Comment AS F2 FROM Songs AS S2 WHERE IDAlbum = " & oSongData.Album.ID & " AND Comment <> '' AND S1.ID <> S2.ID)) || '<ID:1>', '<ID:1>' || Comment || '<ID:1>') = 0 ORDER BY CAST(DiscNumber AS int), CAST(TrackNumber AS int))")
VBScript: checked

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

Post by ZvezdanD » Mon Mar 20, 2017 4:15 am

Preset: Replace LF with CR+LF in Lyrics
Description: A new line is represented as Line Feed character in Unix, but as Carriage Return + Line Feed characters in Windows.
Find what: (?:\r)?\n
Into: Lyrics
RegExp1: checked
Replace with: vbCrLf
VBScript: checked

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

Post by ZvezdanD » Sun Feb 26, 2017 12:32 pm

MMFrLife wrote:However, I would "ideally" like the possibility of maybe another letter or two, but I can do without
if that is a problem (like, maybe problematic if other letter is "A" ([2A], [3A], [23A]...), since it is
already in lowercase section. What happens if "A" is at beginning of title/name or after a digit "within" title or name;
counter-instructing problem again(?))

You could add "\d+[AD]" to the Uppercase section instead, adding whatever character you want to be after digits inside of these [] brackets. The Uppercase section matches only words since it is surrounded by \b anchors. So, if you specify "\d+[AD]" it will match 2A, 2D, 23A, 312D... It will match them anywhere in the field if they are surrounded by any non-word character, e.g. " 2A " or " 2A, " or "[2A]" or "(2A)"... It will not match 2AA because it has two A. If you want to match one or more characters, you should write "\d+[AD]+".

MMFrLife wrote:I would say no. They are minor breaks. Merely pauses (one quick and one slightly extended). They don't have the same prominence as
separators like "-", ":", "(", etc.

You are right. Here is the new update for the begin of Lowercase section "[\-:.!?][ \t]*|[ \t]+".

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

Post by MMFrLife » Sun Feb 26, 2017 11:04 am

Sorry about the commas, I must of been thrown at one point because of the bottom part of the semi-colon and end comma,
thinking everything needed to be separated with a comma (an accidental illusion :lol: ; it was copied and pasted to the post).
So, forget about that. I took the extras out.

Also, I took out the "\d" and forget about the "\d+D" example I gave before (unless it applies again in the exact same form).

ZvezdanD wrote:So, you wanted all words after " - " to be capitalized, even those exceptions in Lowercase group, but I expanded your request to the additional symbols because words after "." or ":" should be also always capitalized, as well after "!" or "?" (which I forgot to add).

Yes, that is what I want. There isn't a problem with that the way it currently sits.

Let's just start with a fresh description:

ZvezdanD wrote:Do you want words after a digit to be always capitalized or what?

Well, I "mainly" want the letter D after a digit or number of digits to be capitalized, not necessarily "all" letters or words after.

ex. of what I want
"[2D]", "[3D]"..... or "[10D]", "[14D]".....

However, I would "ideally" like the possibility of maybe another letter or two, but I can do without
if that is a problem (like, maybe problematic if other letter is "A" ([2A], [3A], [23A]...), since it is
already in lowercase section. What happens if "A" is at beginning of title/name or after a digit "within" title or name;
counter-instructing problem again(?))

ZvezdanD wrote:However, I am still in doubt if those exceptions like "the" should be capitalized after "," and ";".

I would say no. They are minor breaks. Merely pauses (one quick and one slightly extended). They don't have the same prominence as
separators like "-", ":", "(", etc.

ZvezdanD wrote:If you could find rules for that on Internet, please give me a link.

Ok.


- I'm trying to convey best I can come up with, but if you still don't follow (for whatever reason; no fault of yours), I'm gonna have to take a break
from this particular issue for a while.

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

Post by ZvezdanD » Sun Feb 26, 2017 7:19 am

MMFrLife wrote:I just thought I would experiment using "([\-,:,;.,]\W*|[ \t]+" to see if I could get it to skip over the digit to the D, thus capping it.
"([\-,\d:;.,]\W*|[ \t]+"

Sorry, but I still don't understand what you want, and it seems that you didn't understand my description of the "[...]" regular expression either. You should put characters that you want to mach inside those brackets. A single characters. And they should not be separated by anything, e.g. [abc] or [123] or [@#$] or whatever. My suggestion was "[\-:;.,]\W*|[ \t]+" for something completely unrelated and even then I have a single "," inside those brackets, so I don't know why you put additional "," in there. Even less I understand why you put \d inside those brackets. Do you want words after a digit to be always capitalized or what?

Here is a purpose of my suggestion:
ZvezdanD wrote:
MMFrLife wrote:In "Caps with exceptions...", how do I also make articles after " - " capitalized?

You should replace "(?!^)\b" in the predefined preset with "[\-:;.,]\W*|[ \t]+". There are added ":;.," beside of "-" after which a word should be capitalized, you could also add some another characters inside the first pair of [] brackets if you want to have a word capitalized after them.


So, you wanted all words after " - " to be capitalized, even those exceptions in Lowercase group, but I expanded your request to the additional symbols because words after "." or ":" should be also always capitalized, as well after "!" or "?" (which I forgot to add). However, I am still in doubt if those exceptions like "the" should be capitalized after "," and ";". If you could find rules for that on Internet, please give me a link.

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

Post by MMFrLife » Sun Feb 26, 2017 6:45 am

In regards to "[2D]"
"What It Takes - The Chess Years (Expanded Edition) -lv -xb [2D]"
results in "What It Takes - The Chess In Years (Expanded Edition) -lv -xb [2d]"

If I put "|d+D" at the end of Uppercase, like you advised in earlier discussion, it works great to keep it as "[2D]"
It works, no problem. :)

I just thought I would experiment using "([\-,:,;.,]\W*|[ \t]+" to see if I could get it to skip over the digit to the D, thus capping it.
"([\-,\d:;.,]\W*|[ \t]+"

So, is it actually wrong, even though it appears to work, because it will cause problems in other situations?
Or, not necessarily wrong, just "non-standard"?


MMfrLife wrote:to see if I could get it to skip over the digit to the D, thus capping it.

Is it even actually doing that in this case or does it just seem like it?

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

Post by ZvezdanD » Sun Feb 26, 2017 3:18 am

MMFrLife wrote:On the advice you gave with using "|\d+D" for the ID "[2D]", I translated it to ",\d," inserting it into "[\-,\d,:;.,]\W*|[ \t]+".
It appears to work. Is that proper/advisable?

I don't know what you want, but no, it is not proper. You are using one regular expression suggested for one specific case into another different place.

Here is a quick reference:
- "\d" is a regular expression that matches any digit;
- "+" is a quantifier that indicates one or more occurrences of the preceding element;
- so "\d+" means one or more digits;
- "[...]" is a regular expression that matches any single character specified inside those brackets, e.g. [Joe] means J OR o OR e;
- if you want to match any string with multiple characters you could use () brackets and | to alternate these characters, e.g. (Joe|John) means Joe OR John.
- however, the "(...)" brackets create capturing groups, their matches are often used as a reference in the Replace with string, so if you do not want to mess with that, you should use non-capturing (?:...) group instead with the "?:" following the opening bracket.

By the way, if you didn't know, when you click on the leftmost "?" button from the bottom row of controls you would get the short reference for the Regular expressions.

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

Post by MMFrLife » Sat Feb 25, 2017 8:31 pm

ZvezdanD wrote:I suppose you didn't open the Tune/Adjustment dialog box for that preset, otherwise you would see it clearly separate.


Nope. It's one of the few preset types I haven't done that with.
I've had it in a couple of my editing process batches (1 with 3 instances and another with 1).

Yeah, it's tough as to what the name could be to help distinguish it.
"Special"
"Specialcase"
"SpecialSequence"
"Uncommon"
"Uncommoncase"
...and so on

You run into the same problem as "Exact" and Specific" where they all mean or imply the same things.
I mean, the fact that the preset has to do with "exceptions" already, and that there are only 2 cases (lower/upper),
makes a distinction difficult. The "Specific" section also has to do with (upper/lower), the distinction being different kinds of
arrangements/sequencing in where the usual rules of arrangement don't necessarily apply, like "first and last words capitalized", etc.

I settled on and customized mine with "OtherString". I tested out the adjustment/tune dialog and it looks nice in all dialogs!

Quick question:
On the advice you gave with using "|\d+D" for the ID "[2D]", I translated it to ",\d," inserting it into "[\-,\d,:;.,]\W*|[ \t]+".
It appears to work. Is that proper/advisable?

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

Post by ZvezdanD » Sat Feb 25, 2017 1:00 pm

MMFrLife wrote:the Lowercase section
also includes unique, specific strings and I was previously unaware of "Specific" as a "separate" section

I suppose you didn't open the Tune/Adjustment dialog box for that preset, otherwise you would see it clearly separate.

I though to call it "Exact" or something like that, but decided for the "Specific" term.

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

Post by MMFrLife » Sat Feb 25, 2017 11:16 am

"Specific section"!!!

:o :o :o YAY!!!
Wow, that opens up a whole other possibility.

I always wondered why "|BlueRay|iTunes" was sittin' over there to the left.
It's intro'd with "String Caption" like the other sections, but "Specific" after it threw
me as to the fact that it is yet another adjustable section :lol: Yay! :D .

ZvezdanD wrote: :wink: I didn't want to enter into another discussion why you are wrong, but here are again some examples what could happen if you use your mod with the "-" as a word character: Afro-celt, Dark-eyed, Jean-michel, Kung-fu, Itsy-bitsy, Low-life, Non-stop, Ob-la-di, P-funk, Pan-african, Peek-a-boo, Pin-ups, Radio-activity,
Rendez-vous, Set-up, Too-rye-ay, Trans-europa, White-out, X-ray...


Ok, no biggie. But what I meant by remaining point was that I already demonstrated an awareness of the
problem of counter-instructing a repeated character in my previous 2 posts (earlier in the string, later
in the string and trying fresh, the original preset with stripped out symbols). So, sure, not a "full" understanding,
but an awareness.

I mean, the Lowercase section, although it has some strings with "?" and "\", it also has "specific",
normal looking strings like "into, for, from (which I added)". It also includes 2 character strings like,
"in" and "to". "lv" and "xb" are 2 character strings. I didn't include any symbols like "-" in my last test with the
original, unmodified preset and it still didn't work at the end. That and being unaware of a separate "specific" section
is why I was so confused.

When I mentioned giving up, I was only referring to how, now, I can't even seem to get the "Specific String"
thing to work. I didn't mean I was determined to make work what I originally, idealistically had in mind.

ZvezdanD wrote:For the third time, it is the Specific section, not Lowercase.


Yes, third time referencing, first time combining those two terms "Specific section"
It wasn't incorrect before, it just confused me the way it was worded because the Lowercase section
also includes unique, specific strings and I was previously unaware of "Specific" as a "separate" section,
and in turn, unaware of its separate purpose.

It's all good now! :D
Hopefully this will help someone else as well.

Thanks,
Your the best when it comes to the MM scripting game! :wink:

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

Post by ZvezdanD » Sat Feb 25, 2017 8:01 am

MMFrLife wrote:I appreciate you editing down your original reply to the only remaining point :wink:

;) I didn't want to enter into another discussion why you are wrong, but here are again some examples what could happen if you use your mod with the "-" as a word character: Afro-celt, Dark-eyed, Jean-michel, Kung-fu, Itsy-bitsy, Low-life, Non-stop, Ob-la-di, P-funk, Pan-african, Peek-a-boo, Pin-ups, Radio-activity, Rendez-vous, Set-up, Too-rye-ay, Trans-europa, White-out, X-ray...

MMFrLife wrote:To insert, you just create "|xb|" or "|lv|", etc. in lowercase section, right?

For the third time, it is the Specific section, not Lowercase.

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

Post by MMFrLife » Sat Feb 25, 2017 6:07 am

I appreciate you editing down your original reply to the only remaining point :wink:

So, if it is supposed to be working stripped down (original preset, no symbols), then either I'm inserting into LC string section incorrectly
or something is slightly off with my copy of the original preset.

I will try again by extracting the "RegExpReplace.ini" from the .mmip, even though the one I used
was imported from one that is in a read-only state.

To insert, you just create "|xb|" or "|lv|", etc. in lowercase section, right?

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

Post by ZvezdanD » Sat Feb 25, 2017 3:11 am

MMFrLife wrote:I actually tried that before you originally suggested it, but it didn't work.
...
If you put specific string "xb" in the LC section...

It works just fine for me - if I put lv or xb in the Specific string, those your IDs would not be capitalized, even on the end of text.

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

Post by MMFrLife » Fri Feb 24, 2017 10:27 pm

ZvezdanD wrote:you should use the Specific string for your IDs.

I actually tried that before you originally suggested it, but it didn't work.
That works to except words that don't interfere with the "first and last words are capitalized" rule.
However, the IDs are intended to go at the end, "not within" the name.

It appears that no matter what version of the preset used, it continues to adhere to that rule.
I even went back to the predefined preset and took out any symbols in the name of the album.

If you put specific string "xb" in the LC section, and "xb" within the name, you get
"What It Takes the Chess Years xb"
resulting in "What It Takes the Chess Years Xb"

If you have,
"What It Takes the Chess Years lv xb"
resulting in "What It Takes the Chess Years lv Xb"

If you have "xb" within the name,
"What It xb Takes the Chess Years"
resulting in "What It xb Takes the Chess Years"

Anyway, I'm about ready to give up and go back to the way I had it :-?.
Any hyphenated subtitle situations I'll just run all my editing
process batches and manually edit immediately after " - " for any fields it pertains to.

Thanks

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

Post by ZvezdanD » Fri Feb 24, 2017 3:31 pm

MMFrLife wrote:In "Caps with exceptions...", how do I also make articles after " - " capitalized?

You should replace "(?!^)\b" in the predefined preset with "[\-:;.,]\W*|[ \t]+". There are added ":;.," beside of "-" after which a word should be capitalized, you could also add some another characters inside the first pair of [] brackets if you want to have a word capitalized after them.

MMFrLife wrote:Or, is it impossible to except both " - the" (earlier in the string), and "-xb" (later in the string).

Yes, it is impossible. As I said before, you should use the Specific string for your IDs. Or just use some Classification field.

Top