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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby ZvezdanD » Tue Jun 02, 2009 7:19 pm

nynaevelan wrote:I do not know of a way to identify all the affected tracks.

If you are talking about a bug reported in the Beta forum, gege has a Magic Node to display only affected tracks - he said they have exactly 200 characters of lyrics and "..." on the end.

nynaevelan wrote:Is there a way for RegEx to find tracks that have lyrics greater than 1 line but less than 10?

Find what:
Code: Select all
^(.*\r\n){1,10}.*$

RegExp 1: checked
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export M3Us/Create Playlists for Child Nodes 3.6.1 (2012-01-09)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.1 (2012-05-31)  Find Currently Playing Track 1.2 (2012-02-14)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0 (2012-01-16)
Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2594
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby nynaevelan » Tue Jun 02, 2009 7:33 pm

Thank you, it worked perfectly and yes that is the bug I am referring to. I will start with the tracks identified in Gege's node first.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
nynaevelan
 
Posts: 5540
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby gege » Tue Jun 02, 2009 9:46 pm

nynaevelan wrote:I will start with the tracks identified in Gege's node first.

You're welcome! :lol: :lol: :lol:
gege
 
Posts: 844
Joined: Tue Sep 05, 2006 2:10 pm
Location: Brazil

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby nynaevelan » Tue Jun 02, 2009 9:49 pm

gege wrote:
nynaevelan wrote:I will start with the tracks identified in Gege's node first.

You're welcome! :lol: :lol: :lol:


:lol: :lol: :lol: Thank you.
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
nynaevelan
 
Posts: 5540
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby Kevinowpb » Sat Jun 06, 2009 11:11 am

New Question I asked creator and he mentioned I should post to this forum for everyone to see:



Question:

I have a bunch (hundreds) of file names / tags from a 13 gig compilation with the file and tag format of name.artist.album.albumartist.track.title.mp3
... they made it with periods between each word... even in the middle of their name.. ie Britney.Spears-Baby.Hit.Me.One.More.Time-Best.Of.Britney.Spears.mp3

How do I find all periods (.) and replace with spaces?

Response:
re:how do you/ do I do this in your Replace script..?

Sent at: Sat Jun 06, 2009 1:52 pm
From: ZvezdanD
To: Kevinowpb
Well, if it is some normal field like Title or Artist then a solution could be really simple - the Find what string should have a period (".") and the Replace with string should have a space character(" "). However, since a Path field could contain a regular period characters, at least between the filename and the extension, than you should use following settings:


Find what:

Code: Select all
([^\.\\]*?(?:\.+[^\.\\]+?)+)(\.[^\.\\]+)$
Into: Path
Regular expression 1: checked

Replace with:
Code: Select all
Replace("$1", ".", " ") & "$2"

VBScript expression: checked

**Keep in mind that with those settings you would get all periods in the filename replaced with spaces, even if they are after some abbreviations, like U.S.A. or feat. or something similar.

By the way, this question is intriguing and I recommend posting such questions directly in the Forum thread, since many users could be interested to know an answer to it.
Kevinowpb
 
Posts: 119
Joined: Sat Dec 22, 2007 10:18 am
Location: West Palm Beach

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby Kevinowpb » Sat Jun 06, 2009 11:24 am

And... IT WORKED PERFECTLY!!!

THANK YOU!



Kevinowpb wrote:New Question I asked creator and he mentioned I should post to this forum for everyone to see:



Question:

I have a bunch (hundreds) of file names / tags from a 13 gig compilation with the file and tag format of name.artist.album.albumartist.track.title.mp3
... they made it with periods between each word... even in the middle of their name.. ie Britney.Spears-Baby.Hit.Me.One.More.Time-Best.Of.Britney.Spears.mp3

How do I find all periods (.) and replace with spaces?

Response:
re:how do you/ do I do this in your Replace script..?

Sent at: Sat Jun 06, 2009 1:52 pm
From: ZvezdanD
To: Kevinowpb
Well, if it is some normal field like Title or Artist then a solution could be really simple - the Find what string should have a period (".") and the Replace with string should have a space character(" "). However, since a Path field could contain a regular period characters, at least between the filename and the extension, than you should use following settings:


Find what:

Code: Select all
([^\.\\]*?(?:\.+[^\.\\]+?)+)(\.[^\.\\]+)$
Into: Path
Regular expression 1: checked

Replace with:
Code: Select all
Replace("$1", ".", " ") & "$2"

VBScript expression: checked

**Keep in mind that with those settings you would get all periods in the filename replaced with spaces, even if they are after some abbreviations, like U.S.A. or feat. or something similar.

By the way, this question is intriguing and I recommend posting such questions directly in the Forum thread, since many users could be interested to know an answer to it.
Kevinowpb
 
Posts: 119
Joined: Sat Dec 22, 2007 10:18 am
Location: West Palm Beach

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby barkoz » Sun Jun 07, 2009 7:33 pm

Can someone tell me how to capitalise the first letter of each WORD (lowercaseing others) in the Lyrics/Comment without getting I'M, Don'T etc.
I had this right once.... but a crash and burn with XP... It's killing me... now my brain is about to crash and burn. HELP! LOL
Barkoz :) :) :)
barkoz
 
Posts: 121
Joined: Fri May 02, 2008 5:58 pm
Location: Sydney, Australia

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby ZvezdanD » Mon Jun 08, 2009 1:21 pm

barkoz wrote:how to capitalise the first letter of each WORD (lowercaseing others) in the Lyrics/Comment without getting I'M, Don'T etc.

Did you try the "Capitalize the Title" preset with the Lyrics set in the Into drop-down list? Are you sure that you have single apostrophe in I'm, Don't? Maybe it is acute/grave accent or single quotation mark. If this is a case, you could first use the "Replace acute/grave accent and single quotation mark with the apostrophe" preset, or you could use following modified Find what string with the Capitalize preset:
Code: Select all
([\w\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF])([\w'´`’‘\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*)

If I remember correctly, I already posted such preset before, maybe even to you...
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export M3Us/Create Playlists for Child Nodes 3.6.1 (2012-01-09)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.1 (2012-05-31)  Find Currently Playing Track 1.2 (2012-02-14)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0 (2012-01-16)
Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2594
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby barkoz » Wed Jun 10, 2009 4:04 am

ZvezdanD wrote
Are you sure that you have single apostrophe in I'm, Don't? Maybe it is acute/grave accent or single quotation mark. If this is a case, you could first use the "Replace acute/grave accent and single quotation mark with the apostrophe" preset,


That was it... Thank'S mate, dum dum didn'T know what grave accents were. LOL
:D :D :D
barkoz
 
Posts: 121
Joined: Fri May 02, 2008 5:58 pm
Location: Sydney, Australia

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby CarlG » Sat Jun 13, 2009 10:28 pm

Thanks for a great script - as I use it more, I continue to learn how powerful it can be.

However, the number of presets has become unwieldy, and I share people's request for a way to organize them, perhaps into nested folders.

Is there also a way to delete presets without having them reappear upon updating? If not, is there a way to update just the master script, then somehow manually load the new presets?

Thanks, Carl.
CarlG
 
Posts: 7
Joined: Sun Sep 10, 2006 4:43 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby ZvezdanD » Sun Jun 14, 2009 2:22 am

CarlG wrote:is there a way to update just the master script, then somehow manually load the new presets?

Of course you could update just the script file. During the installation when the dialog box asking "Would you like to add the x new sample presets from the install package?" appears, just choose "No". And of course you could manually load the new presets - just choose Edit / RegExp Export/Import and in new dialog choose File - C:\Program Files\MediaMonkey\Scripts\Auto\RegExpReplace.ini
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export M3Us/Create Playlists for Child Nodes 3.6.1 (2012-01-09)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.1 (2012-05-31)  Find Currently Playing Track 1.2 (2012-02-14)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0 (2012-01-16)
Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2594
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby CarlG » Sun Jun 14, 2009 2:05 pm

Great - thanks. I'll give this a try with your next update.

Cheers, Carl.
CarlG
 
Posts: 7
Joined: Sun Sep 10, 2006 4:43 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby TuRDMaN » Tue Jun 16, 2009 12:11 am

Hi, I'm trying to write a couple presets but can't quite get them right.

First, I have my Artist tags set up as Artist (feat. Artist2, Artist3 & Artist4), and I'd like to change them to the multi-artist format (Artist1; Artist2; Artist3; Artist4)
The best I've managed to do is replace (feat. | , | & with ; but that ends up leaving the trailing ) at the end, which I have to clean up with another preset.

Also, I would like to make a preset to extract Album Artist from the path (ex. P:\MP3\Albums\ARTIST- Album\song.mp3) and replace the Album Artist tag with it. I'm pretty sure I could do this one using lookbehind, but lookbehind isn't implemented in this script (is it?)

Any help would be greatly appreciated!
TuRDMaN
 
Posts: 2
Joined: Tue Jun 16, 2009 12:04 am

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby ZvezdanD » Tue Jun 16, 2009 2:48 am

TuRDMaN wrote:I have my Artist tags set up as Artist (feat. Artist2, Artist3 & Artist4), and I'd like to change them to the multi-artist format (Artist1; Artist2; Artist3; Artist4)
The best I've managed to do is replace (feat. | , | & with ; but that ends up leaving the trailing ) at the end, which I have to clean up with another preset.

The next preset will replace all feat. pres. vs. with ";" and remove ending parentheses no matter what is inside of them, so you should check the result before you choose the Replace command (you could expand the preset further to check cases when parentheses don't contain featuring artists, but it would be more complicated):
Find what:
Code: Select all
^.*

Into: Artist
Regular expression 1: checked
Replace with:
Code: Select all
RegSub(RegSub("$&", "\s?\b(&|feat\.?|featuring|features|ft\.?|presenting|presents|pres\.?|versus|vs\.?)\s", "; "), "(.+)\s\(([^)]*)\)$", "$$1$$2")

VBScript expression: checked

TuRDMaN wrote:I would like to make a preset to extract Album Artist from the path (ex. P:\MP3\Albums\ARTIST- Album\song.mp3) and replace the Album Artist tag with it.

I think Auto-Tag from Filename would be easier, but if you are still interested you could try with:
Find what:
Code: Select all
^.*

Into: Album Artist
Regular expression 1: checked
Replace with:
Code: Select all
RegExp(RegExpEx(oSongData.Path, "\\([^\\]+)\\([^\\]+)\.([^\.\\]+)$", 0, 0), "^([^-]*)(?=\s-\s.*)", 0)

VBScript expression: checked

TuRDMaN wrote:I'm pretty sure I could do this one using lookbehind, but lookbehind isn't implemented in this script (is it?)

Wow, you know Regular expressions very well if you are aware about lookbehind. Yeah, this is something which is missing really badly, but unfortunately it is not a problem with my script, but with the VBScript implementation of the Regular expressions. You should blame Micro$oft for this. :evil:
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export M3Us/Create Playlists for Child Nodes 3.6.1 (2012-01-09)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.1 (2012-05-31)  Find Currently Playing Track 1.2 (2012-02-14)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0 (2012-01-16)
Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2594
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-05-14)[MM2+3]

Postby TuRDMaN » Tue Jun 16, 2009 4:35 am

ZvezdanD wrote:Wow, you know Regular expressions very well if you are aware about lookbehind. Yeah, this is something which is missing really badly, but unfortunately it is not a problem with my script, but with the VBScript implementation of the Regular expressions. You should blame Micro$oft for this. :evil:

Ah, good to know. When in doubt, blame Micro$oft!

Thanks for all the help, I'll go try it out now!


Edit: With a little modification, the first preset is working exactly how I would like it to, and the 2nd worked just fine the way it was. Thanks again for the help!
TuRDMaN
 
Posts: 2
Joined: Tue Jun 16, 2009 12:04 am

PreviousNext

Return to Need Help with Addons?

Who is online

Users browsing this forum: No registered users and 12 guests