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 » Tue Jul 28, 2015 2:42 pm

Here is the excerpt from the Installation section of the first post of this thread (and from the add-on's Web page in that matter):
"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.

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

Post by pintree3 » Tue Jul 28, 2015 2:16 pm

Camus II wrote:The presets that are in use via Edit > Tag Manipulation Presets are stored in ..\AppData\Roaming\MediaMonkey\MediaMonkey.ini under the heading [RegExpPresets]. So just keep a back up copy of MediaMonkey.ini (or keep a separate text copy of your presets) and then you can copy and paste the [RegExpPresets] settings from that into any other/future installations.


I'm sure I had replied to this thanking you but I can't seem to see my reply--sorry but I did.
Anyhow another question popped up, or rather a part of my 1st question. I had asked what happens since there is now a new version?
You may have answered this but let me ask again and then go back to what may have been your answer.
Could I assume that if I install the new 4.4 version on top of this one all my previous deletes and modifications will be lost? OR if I back up my settings now and then in my new system install the new version, and then after this, replace my present .ini file then I would screw things up, wouldn't I?
Assuming yes to both, would it be safe to assume that installing a new version will automatically any changes made? or is there a way around this?
About your answer, you wrote, "or keep a separate text copy of your presets" I found that part in the .ini file. If I install the new version will changing this part alone affect anything else?

Thanks again

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

Post by Camus II » Tue Jul 28, 2015 4:42 am

The presets that are in use via Edit > Tag Manipulation Presets are stored in ..\AppData\Roaming\MediaMonkey\MediaMonkey.ini under the heading [RegExpPresets]. So just keep a back up copy of MediaMonkey.ini (or keep a separate text copy of your presets) and then you can copy and paste the [RegExpPresets] settings from that into any other/future installations.

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

Post by pintree3 » Mon Jul 27, 2015 10:06 pm

Is there a way to back this up? I'm moving country and won't be taking my PC with me--hence will need to reinstall my MM once I get a new one.
I love this plugin--what a godsend :-) Seeing that about 2/3 of the commands I don't use I deleted them, and I modified a few of the others. I would hate to do it all over again hence me asking--and if it is possible to save them, can they migrate to the new version 4.4?

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

Post by MMFrLife » Thu Jun 25, 2015 11:34 am

I've tried out the first preset and got it to work great. It is saved in my preset menu now. I haven't tried out the other ones but looking forward to
coming across the need, to see if they work. I'll edit back here if I do.

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

Post by MMFrLife » Mon Jun 15, 2015 6:46 pm

terrypin wrote:So it sounds like the RegEx used by the add-on differs in syntax or functionality in some way.

Yes, I figured as much. With Z's confirmation, it looks to be the case.

Thanks again, though!

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

Post by MMFrLife » Mon Jun 15, 2015 6:41 pm

Whoa!!! Looks like the Z man is doing his rain dance again and makin' it rain presets!
Thanks! I'll have to look into some of those and post back here later.

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

Post by ZvezdanD » Mon Jun 15, 2015 12:05 pm

Preset: Remove specified string from <Into Field> after another specified string...
Description: Remove all "String to remove", but only after the first (leftmost) occurrence of another specified string
Find what: ^(.*?<String Caption="Remove after string" Value="\">)(.*)
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1))

Preset: Remove specified string from <Into Field> before another specified string...
Description: Remove all "String to remove", but only before the last (rightmost) occurrence of another specified string
Find what: (.*)(<String Caption="Remove before string" Value="\">.*?)$
Replace with: Replace("$1", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$2"

Preset: Remove specified string from <Into Field> after rightmost another specified string...
Description: Remove all "String to remove", but only after the last (rightmost) occurrence of another specified string
Find what: ^(.*<String Caption="Remove after string" Value="\">)(.*)
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1))

Preset: Remove specified string from <Into Field> before leftmost another specified string...
Description: Remove all "String to remove", but only before the first (leftmost) occurrence of another specified string
Find what: (.*?)(<String Caption="Remove before string" Value="\">.*)$
Replace with: Replace("$1", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$2"

Preset: Remove specified string from <Into Field> after specified occurrences of another specified string...
Description: Remove all "String to remove", but only after the specified number of occurrences of another specified string
Find what: ^((?:.*?<String Caption="Remove after string" Value="\">){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})(.*)
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1))

Preset: Remove specified string from <Into Field> before specified occurrences of another specified string...
Description: Remove all "String to remove", but only before the specified number of occurrences of another specified string
Find what: (.*)((?:<String Caption="Remove before string" Value="\">.*?){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})$
Replace with: Replace("$1", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$2"

Preset: Remove specified string from <Into Field> between two another specified strings...
Description: Remove all "String to remove", but only after the first (leftmost) occurrence of the first specified string and before the last (righmost) occurrence of the second specified string
Find what: ^(.*?<String Caption="Remove after string" Value="\">)(.*)(<String Caption="Remove before string" Value="\">.*?)$
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$3"

Preset: Remove specified string from <Into Field> between specified occurrences of another specified strings...
Description: Remove all "String to remove", but only after the specified number of occurrences of the first specified string and before the specified number of occurrences of the second specified string
Find what: ^((?:.*?<String Caption="Remove after string" Value="\">){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})(.*)((?:<String Caption="Remove before string" Value="\">.*?){<Number Caption="Number of occurrences" Value="2" MinValue ="1" MaxValue ="100">})$
Replace with: "$1" & Replace("$2", "<String Caption="String to remove" Value="-">", "", 1, -1, IIf(bMatchCase, 0, 1)) & "$3"

Regular expression 1 and VBScript expression: checked in all presets

By the way, the VBScript's RegEx engine used in this add-on doesn't support "\G".

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

Post by terrypin » Mon Jun 15, 2015 10:08 am

I updated my text editor so that it now uses the same more powerful version of RegEx as my expert friend's.

If I now apply the expression

Find: (^(?:[^\\\n]*\\){2}.*?|\G.*?)-
Replace with: $1

...to these test strings (including your example)

F:\Folder -1-\Folder -2-\-Folder- -3-\name1-name2.flac
X:\abc-def\123-456\-xyz-789
C:\xyz-123\abc-456-\- 1- pq-\this-that-\-other\artist-album.mp3


I get this result, which looks as if it does what you want:

F:\Folder -1-\Folder 2\Folder 3\name1name2.flac
X:\abc-def\123456\xyz789
C:\xyz-123\abc456\ 1 pq\thisthat\other\artistalbum.mp3


So it sounds like the RegEx used by the add-on differs in syntax or functionality in some way.

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

Post by MMFrLife » Sun Jun 14, 2015 12:45 pm

I've only looked at it for one path example (with only 2 folders), but it appears to recognize only some character parts of a folder(s) in the path
and completely disregards the filename. If I choose 2, it takes care of the single hyphen in that folder string. But if I choose 1, it
eliminates only the first one of two hyphens in that folder string. ...seems close, though!

Thanks for your efforts. I appreciate you going out of your way. :)

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

Post by terrypin » Sun Jun 14, 2015 9:38 am

Until ZvezdanD comes along, maybe this will help. I consulted an online friend who's a RegEx guru (I know only the basics) and he reckons this regex expression will do it:

Find: (^(?:[^\\\n]*\\){2}.*?|\G.*?)-
Replace with: $1

I'm assuming:

1. His version of RegeEx (I think it's PERL) is the same as the add-on uses. (It's not the same as my aging text editor uses; that's a POSIX version.)
2. You know how to use the add-on UI to incorporate that. (I made a brief but unsuccessful attempt.)

P.S: That was for the string following the 2nd backslash; you'd adapt for 3rd, 4th, etc.

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

Post by MMFrLife » Fri Jun 12, 2015 9:47 pm

How do I remove all of a certain character from a particular starting point in the path.

For ex., I want to remove all "-" (hyphens) starting at the 2nd folder (or any defined position = 1 or 2 or 3...), something like:
F:\Folder -1-\Folder -2-\-Folder- -3-\name1-name2.flac

So, all hyphens to the right of folder -1- would be removed.

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

Post by Hdhntr23 » Fri May 29, 2015 9:16 am

Thanks!

I do have it set to actively "monitor" my dbase, so maybe after I do a restart of MM it'll rename those changed files.

If not, Ill set up a mask to rename the files.

You've been a big help I appreciate it.

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

Post by dtsig » Fri May 29, 2015 8:27 am

And if that doesn't work .. once you have your tags all set you could simply use Auto-Organize Files (Ctrl-R). Set up a mask and this will "rename" all the files (or should .. windows is funny about knowing there is a difference in file name 'This IS' and 'this is'). But with the correct mask it would simply go through and rename the files ..

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

Post by MMFrLife » Fri May 29, 2015 6:41 am

Hdhntr23 wrote:Anyway, is there a preset to capitalize every first letter of each word in a field?

So, you wanted it for the song/title field, but you also want it for the track title in the path?
Changing the into field to filename doesn't work?

Top