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 dtsig » Thu Sep 03, 2015 9:42 pm

ZvezdanD
Hate to bother you with this but I have 2 questions ..

1) I modified the script you noted earlier as I needed to append year to the title on movies. So i went with
^.*
IIf(Len("$&") > 0, " $&", "") & " - " & oSongData.Year

It went pretty well but I feel it is all wrong as now on the 30-40 I tried it on all have a leading space ..

2) What would be used to remove a leading space .. i can edit by hand but ..

Thanks
DSig

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

Post by NWDreamer » Wed Sep 02, 2015 10:50 am

Yep, you are right. I went through the Uppercase presets (which say "Lyrics") and missed the Capitalize ones completely. *Sigh...* :oops:

I'm trying to load about 300,000 songs into MM (105,000 in so far) and just dealing with that type of quantity is obviously making my head spin. Sorry!

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

Post by ZvezdanD » Wed Sep 02, 2015 10:02 am

NWDreamer wrote:It's hard to go through that large list to find what you want

Is that harder than this:
NWDreamer wrote:I was using it with the Title field to find " a" (space, lowercase 'a') and replace it with " A" then " b" to be replaced with " B" and so on. Then I would go through the whole exercise again with "(a" to "(A" etc.

that you wanted to do?
NWDreamer wrote:I went through the Capitalize presets but may have overlooked potential ones since they said "Lyrics" in them.

The two predefined "Capitalize <Into Field>..." presets don't have "Lyrics" in their names and by default they could be used with any textual field.

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

Post by NWDreamer » Wed Sep 02, 2015 9:51 am

ZvezdanD wrote:
NWDreamer wrote:My preferred format is every word (including those in parentheses) with the first letter capitalized. Example: "Another Brick In The Wall (Remastered)" So I still don't see a real easy way to accomplish this, but I'll keep trying.

ZvezdanD wrote:Did you try any of "Capitalize..." presets? They would uppercase the first letters and lowercase the other ones for all words in the specified field.


Looks like you're so quick with your replies that you were posting while I was! I went through the Capitalize presets but may have overlooked potential ones since they said "Lyrics" in them. Now that I realize you can change the <Into Field> I will revisit them.

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

Post by NWDreamer » Wed Sep 02, 2015 9:48 am

Ok, I uninstalled, then added it back (got an Object Required error, but exiting MM and bringing it back up seemed to fix it). I now have a Preset 0 which was definitely not there the last time and it's exactly what I want. I've saved the sections from the .ini file that pertain to RegExp so I feel a little bit better about experimenting. It's hard to go through that large list to find what you want so I think I'll reduce it by removing presets I know I'll never use and reordering things a little. Then maybe find a Regular Expression tutorial!

Thanks again for the reply!

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

Post by ZvezdanD » Wed Sep 02, 2015 9:48 am

NWDreamer wrote:My preferred format is every word (including those in parentheses) with the first letter capitalized. Example: "Another Brick In The Wall (Remastered)" So I still don't see a real easy way to accomplish this, but I'll keep trying.

ZvezdanD wrote:Did you try any of "Capitalize..." presets? They would uppercase the first letters and lowercase the other ones for all words in the specified field.

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

Post by NWDreamer » Wed Sep 02, 2015 9:22 am

Thanks for the quick reply. Being new to this I hadn't created any additional presets and I thought I said yes to remove all add-on settings. That said, I'll try an uninstall/reinstall again to see if I get the standard Find & Replace back. I'll also save the entire section from the .ini file so I can easily go back to it if I dork something up.

Also, my preset 240 says "Uppercase only first letter of each line or sentence of Lyrics, others unchanged" so I've never used it (I don't keep Lyrics). I didn't realize until now that I could easily change the <Into Field>.

My preferred format is every word (including those in parentheses) with the first letter capitalized. Example: "Another Brick In The Wall (Remastered)" So I still don't see a real easy way to accomplish this, but I'll keep trying.

Thanks for the help!

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

Post by ZvezdanD » Wed Sep 02, 2015 7:23 am

NWDreamer wrote:Now that I am using v4.4.1, I can't seem to find the generic "Find & Replace in <Into Field>" that I used to use a lot. I believe it used to be the top preset, but that's now "Replace underlines with spaces in <Into Field>..."

The "Replace specified string with another one in <Into Field>..." preset is the first predefined preset since v4.0 when I have added a possibility to specify <Into Field> and <String> tags in Find what and Replace with strings. I decided to put it on the top since I think it is most important preset that has basically the same or similar function as the Replace option in any normal application like text editor.

If that preset is not on the top of your list, that could be because of several things, most probably because of your actions, e.g. if you removed it or moved it downward in the list. Also, maybe during the installation your old and new presets somehow messed up. Here is the excerpt of the Installation section:
"If you are upgrading this add-on from some old version, especially if there is updated syntax of presets, it is strongly recommend to follow these steps:
1. make a backup of your own created presets using the Edit / RegExp Export/Import dialog box;
2. uninstall old version of add-on and choose Yes when you are asked if you want to remove add-on settings;
3. install the new version of add-on;
4. import your own created presets using the Edit / RegExp Export/Import dialog box.

In that way you would always have the latest and updated presets. If you don't remove old settings (together with presets), during the installation this script would check the preset's names and if they are same as old ones it would skip their installation, even if they are updated."

The add-on's menu is modified in the 4.4 version. So, when you want to import presets, instead of Edit / RegExp Export/Import option there is now Edit / RegExp Find and Replace / Manage Presets option (now it could be found in the popup menus and the toolbar as well). When I am already at it, maybe I should mention that instead of Edit / RegExp Find and Replace option now you could use Edit / RegExp Find and Replace / Preset Settings option to get the same RegExp main dialog box.

NWDreamer wrote:FYI - I was using it with the Title field to find " a" (space, lowercase 'a') and replace it with " A" then " b" to be replaced with " B" and so on. Then I would go through the whole exercise again with "(a" to "(A" etc. Part of this comes from the fact that the Auto Playlists don't differentiate between uppercase and lowercase (very annoying actually). If there's an easier way to do this using one or two RegExp's I'd love to know how! The third in my trio would find any title that starts with a lowercase letter and make it an uppercase letter.

Did you try any of "Capitalize..." presets? They would uppercase the first letters and lowercase the other ones for all words in the specified field. You could also try "Uppercase only first letter of each line or sentence of Lyrics, others unchanged" but you need to replace Lyrics with the wanted field in the Into combo box of the Preset Settings dialog box.

Or, you could use this preset:
Preset: Uppercase only first letter of <Into Field>, others unchanged...
Description: another Brick in the Wall -> Another Brick in the Wall
Find what: ^[^\w\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*[\w\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]
Regular expression 1: checked
Replace with: UCase("$&")
VBScript: checked

Or, maybe this one:
Preset: Uppercase first letter of <Into Field> and lowercase others...
Description: another Brick in the Wall -> Another brick in the wall
Find what: ^([^\w\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*[\w\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF])(.*)
Regular expression 1: checked
Replace with: UCase("$1") & LCase("$2")
VBScript: checked

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

Post by NWDreamer » Wed Sep 02, 2015 4:54 am

ZvezdanD wrote:
NWDreamer wrote:In Extensions it says I'm using v4.4.0.1 of your script.

I have fixed the mentioned problem in v4.4.1. Thank you for the report.


Ah... Another hopefully dumb question! Now that I am using v4.4.1, I can't seem to find the generic "Find & Replace in <Into Field>" that I used to use a lot. I believe it used to be the top preset, but that's now "Replace underlines with spaces in <Into Field>..." It allowed me to hit a toolbar icon, then enter what I want to find and what I want to replace it with as well as the <Into Field> using a dialog box.

FYI - I was using it with the Title field to find " a" (space, lowercase 'a') and replace it with " A" then " b" to be replaced with " B" and so on. Then I would go through the whole exercise again with "(a" to "(A" etc. Part of this comes from the fact that the Auto Playlists don't differentiate between uppercase and lowercase (very annoying actually). If there's an easier way to do this using one or two RegExp's I'd love to know how! The third in my trio would find any title that starts with a lowercase letter and make it an uppercase letter.

Thanks!

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

Post by dtsig » Sat Aug 29, 2015 7:10 am

ZvezdanD wrote:
dtsig wrote:Would it be possible to put a keycombo to run one of the presets. So if i have 255 as an preset, could there be a way to set say Ctrl+Shift+R to automatically run that specific preset on selected items ... this would be really sweet. Not having to go into the window .. .select a preset ... run .. close

Here is the excerpt from the Usage section:
"The next control is the Shortcut text box which could be used to specify keyboard hotkey for the selected preset, for example Ctrl+T, which allows us to apply such preset to the selected tracks by the press on that hotkey."

And, if you prefer mouse over keyboard, there is another way to apply some preset without opening any dialog box or searching the wanted preset in the Tag Manipulation Presets menu:
"After that we have the Toolbar button check box which should be checked on if we want to get the toolbar button for the selected preset displayed on the main toolbar".

Missed it .. sorry will read harder. Thanks

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

Post by dtsig » Sat Aug 29, 2015 7:08 am

Guest wrote:@dtsig

I finally figured it out. I needed to use 'vbNewline'
Thanks for the input, though.

Great to know ...

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

Post by dtsig » Sat Aug 29, 2015 7:07 am

ZvezdanD wrote:
dtsig wrote:If the first 4 characters are "S"##"E" then don't run
If the last 6 characters are "- "#### then don't run

Find what: ^(?!S\d\dE\d\d).*
Replace with: IIf(IsNumeric(oSongData.SeasonNumber) And IsNumeric(oSongData.EpisodeNumber) And (Len("$_") > 5 Imp Mid("$_", Max(Len("$_") - 5, 0), 2) <> "- " And Not IsNumeric(Right("$_", 4))), "S" & Right("0" & oSongData.SeasonNumber, 2) & "E" & Right("0" & oSongData.EpisodeNumber, 2) & IIf(Len("$_") > 0, " ", ""), "") & "$_"

Oh man .. i sure wish I spoke martian <G> ... thanks a lot. Will give that a try

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

Post by ZvezdanD » Sat Aug 29, 2015 3:36 am

dtsig wrote:If the first 4 characters are "S"##"E" then don't run
If the last 6 characters are "- "#### then don't run

Find what: ^(?!S\d\dE\d\d).*
Replace with: IIf(IsNumeric(oSongData.SeasonNumber) And IsNumeric(oSongData.EpisodeNumber) And (Len("$_") > 5 Imp Mid("$_", Max(Len("$_") - 5, 0), 2) <> "- " And Not IsNumeric(Right("$_", 4))), "S" & Right("0" & oSongData.SeasonNumber, 2) & "E" & Right("0" & oSongData.EpisodeNumber, 2) & IIf(Len("$_") > 0, " ", ""), "") & "$_"

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

Post by Guest » Sat Aug 29, 2015 3:29 am

@dtsig

I finally figured it out. I needed to use 'vbNewline'
Thanks for the input, though.

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

Post by ZvezdanD » Sat Aug 29, 2015 2:42 am

dtsig wrote:Would it be possible to put a keycombo to run one of the presets. So if i have 255 as an preset, could there be a way to set say Ctrl+Shift+R to automatically run that specific preset on selected items ... this would be really sweet. Not having to go into the window .. .select a preset ... run .. close

Here is the excerpt from the Usage section:
"The next control is the Shortcut text box which could be used to specify keyboard hotkey for the selected preset, for example Ctrl+T, which allows us to apply such preset to the selected tracks by the press on that hotkey."

And, if you prefer mouse over keyboard, there is another way to apply some preset without opening any dialog box or searching the wanted preset in the Tag Manipulation Presets menu:
"After that we have the Toolbar button check box which should be checked on if we want to get the toolbar button for the selected preset displayed on the main toolbar".

Top