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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Guest

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

Post by Guest » Thu Aug 27, 2015 11:10 am

Hi

I'm using this to add 'Checked and Edited:' in bulk to the end of existing Lyrics. Preset 47 does that to a point, but I want to put in a carriage return (newline) before the text is added. I think I need to use vb to do the replace but It's got me foxed in this context. Can anyone help me with that, please. Thanks

dtsig
Posts: 2979
Joined: Mon Jan 24, 2011 6:34 pm

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

Post by dtsig » Thu Aug 27, 2015 4:20 pm

try

& vbCr

that *should* work

or

& Chr(13)
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

dtsig
Posts: 2979
Joined: Mon Jan 24, 2011 6:34 pm

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

Post by dtsig » Fri Aug 28, 2015 5:02 pm

ZvezdanD
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

Don't try this at home without a backup <G>
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

dtsig
Posts: 2979
Joined: Mon Jan 24, 2011 6:34 pm

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

Post by dtsig » Fri Aug 28, 2015 5:17 pm

Help with regexp please ..

The great preset i was give works great. But to be sure I don't DOUBLE join is there a way to make sure that it wont work in the following situation ..

If the first 4 characters are "S"##"E" then don't run
If the last 6 characters are "- "#### then don't run (this is for a modifie version of the preset that adds dates to then of films)

I have not been able to work this out. I think I have said before .. there is something about regular expressions I just don't get <G> probably the Old Dog/New tricks thing
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

ZvezdanD
Posts: 3084
Joined: Thu Jun 08, 2006 7:40 pm

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".
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

Guest

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.

ZvezdanD
Posts: 3084
Joined: Thu Jun 08, 2006 7:40 pm

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, " ", ""), "") & "$_"
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

dtsig
Posts: 2979
Joined: Mon Jan 24, 2011 6:34 pm

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
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

dtsig
Posts: 2979
Joined: Mon Jan 24, 2011 6:34 pm

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 ...
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

dtsig
Posts: 2979
Joined: Mon Jan 24, 2011 6:34 pm

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
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

NWDreamer
Posts: 103
Joined: Fri Aug 24, 2012 4:12 am

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!
Craig B. (a.k.a., NW Dreamer - Gold MediaMonkey user.)

ZvezdanD
Posts: 3084
Joined: Thu Jun 08, 2006 7:40 pm

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
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

NWDreamer
Posts: 103
Joined: Fri Aug 24, 2012 4:12 am

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!
Craig B. (a.k.a., NW Dreamer - Gold MediaMonkey user.)

ZvezdanD
Posts: 3084
Joined: Thu Jun 08, 2006 7:40 pm

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.
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 / 5.4  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.7 / 4.0  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.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

NWDreamer
Posts: 103
Joined: Fri Aug 24, 2012 4:12 am

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!
Craig B. (a.k.a., NW Dreamer - Gold MediaMonkey user.)

Post Reply