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 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?

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

Post by terrypin » Fri May 29, 2015 1:12 am

Hdhntr23 wrote:
If I could figure out how to post screenshots for you guys I would. I dont have a pic hosting site and this BBoard doesnt allow uploads of images that I can tell.


I'd recommend you get a free Dropbox account. It's easy to set up and use. Upload your screenshot to it, note the link, and paste it in full directly into your post here. Same for a video clip.

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

Post by Hdhntr23 » Thu May 28, 2015 9:14 pm

Ok so for anyone else wondering how to get JUST the highlights to show this is how you do it...

Uncheck all of the check boxes on the upper left. Then on the lower right hand side, select "keep to replace".

The software then will query your dbase and bring back a list of the songs that have your list of edits in them.

Select all under edit then open find and replace and voila youll have your list with ONLY the yellow highlights!!

Hope this helps someone in the future!

If I could figure out how to post screenshots for you guys I would. I dont have a pic hosting site and this BBoard doesnt allow uploads of images that I can tell.

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

Post by Hdhntr23 » Tue May 26, 2015 9:28 pm

Thanks to everyone thats answered my questions. I really appreciate it.

One thing Im noticing is that when I make a change to a song title (As I mentioned I am currently trying to capitalize every first letter of every word on 40K+ files) is that the text in the path doesnt change with the edits... Not a HUGE deal but Im wondering if it should?

I have read the first post and have it in a word doc that I have opened in as Im doing my edits but I still can not for the life of me figure out how to only show the files that are up to edit vs. ALL of my files. I think it has something to do with the check boxes on the left of the titles as well as one of those button options in the lower left "keep matched" etc...

Its KILLING me that I can't figure this part out. ANY help would be very much appreciated.

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

Post by MMFrLife » Sun May 24, 2015 3:35 pm

I tried the last (simplest) one and it worked brilliantly!
...and all that without knowing an exact path. You da man, Z! 8)
Big Thanks!

Top