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

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Muther
Posts: 27
Joined: Thu Jun 05, 2008 3:47 pm

Post by Muther »

ZvezdanD wrote:
Muther wrote:the second expression (\r\n){3,} only strips out double blank lines. which is useful and I can use it but still need to go in and fix the double line spaces
Sorry, but I could not read your mind. I already said that I don't know what you want and you didn't explained me more specific what is your intention. Send me one wrong lyrics with extra spaces and same lyrics which you cleaned by hand, so I could see what you want.

Ok I'll try to show you what I mean..... I have a lot of lyrics that look like this -
Acting like a maniac

Whiplash



Bang your head against the stage

Like you never did before

Make it ring Make it bleed

Make it really sore

In a frenzied madness

with your leather and your spikes

Heads are bobbing all around

It is hot as hell tonight



Adrenaline starts to flow

You're thrashing all around

Acting like a maniac

Whiplash

Here on the stage the Marshal noise

is piercing through your ears

It kicks your ass kick your face

Exploding feeling nears

Now is the time to let it rip

To let it fuckin' loose

We are gathered here to im and kill

Cause this is what we choose



Adrenaline starts to flow

You're thrashing all around

Acting like a maniac

Whiplash



The show is through the metal is gone

It is time to hit the road

Another town Another gig

Again we will explode

Hotel rooms and motorways

Life out here is raw

But we will never stop

We will never quit

cause we are Metallica



Adrenaline starts to flow

You're thrashing all around

Acting like a maniac

Whiplash
and I want them to look like this
Acting like a maniac
Whiplash

Bang your head against the stage
Like you never did before
Make it ring Make it bleed
Make it really sore
In a frenzied madness
with your leather and your spikes
Heads are bobbing all around
It is hot as hell tonight

Adrenaline starts to flow
You're thrashing all around
Acting like a maniac
Whiplash

Here on the stage the Marshal noise
is piercing through your ears
It kicks your ass kick your face
Exploding feeling nears
Now is the time to let it rip
To let it fuckin' loose
We are gathered here to im and kill
Cause this is what we choose

Adrenaline starts to flow
You're thrashing all around
Acting like a maniac
Whiplash

The show is through the metal is gone
It is time to hit the road
Another town Another gig
Again we will explode
Hotel rooms and motorways
Life out here is raw
But we will never stop
We will never quit
cause we are Metallica

Adrenaline starts to flow
You're thrashing all around
Acting like a maniac
Whiplash
I get there by pressing (starting on the first blank line) delete then the down arrow then delete then the down arrow all the way to the end of the file. I use to do this as I saw them and had the time to do it.




sometimes the file looks like this........ with a gap in the middle of the text not a huge deal but I display the lyrics pannel so every extra line is a scroll maker
Rat-tailed Jimmy is a second hand hood
He deals out in Hollywood
Got a '65 Chevy, primered flames
Traded for some powdered goods
Jigsaw Jimmy He's runnin' a gang
But I hear he's doin' o.k.
Got a cozy little job, sells the Mexican mob
Packages of candycaine

He's the one they call Dr. Feelgood
He's the one that makes ya feel alright
He's the one they call Dr. Feelgood







Cops on the corner always ignore
Somebody's getting paid
Jimmy's got it wired, law's for hire
Got it made in the shade
Got a little hideaway, does business all day
But at night he'll always be found
Selling sugar to the sweet
People on the street
Call this Jimmy's town

He's the one they call Dr. Feelgood
He's the one that makes ya feel alright
He's the one they call Dr. Feelgood
He's gonna be your Frankenstein I've got one thing you'll understand
He's not what you'd call a glamorous man
Got one thing that's easily understood
He's the one they call Dr. Feelgood


but after I run the 2nd formula (\r\n){3,} that you gave me it fixes the mutipal blank lines in the file and it looks like this
Rat-tailed Jimmy is a second hand hood
He deals out in Hollywood
Got a '65 Chevy, primered flames
Traded for some powdered goods
Jigsaw Jimmy He's runnin' a gang
But I hear he's doin' o.k.
Got a cozy little job, sells the Mexican mob
Packages of candycaine

He's the one they call Dr. Feelgood
He's the one that makes ya feel alright
He's the one they call Dr. Feelgood

Cops on the corner always ignore
Somebody's getting paid
Jimmy's got it wired, law's for hire
Got it made in the shade
Got a little hideaway, does business all day
But at night he'll always be found
Selling sugar to the sweet
People on the street
Call this Jimmy's town

He's the one they call Dr. Feelgood
He's the one that makes ya feel alright
He's the one they call Dr. Feelgood
He's gonna be your Frankenstein I've got one thing you'll understand
He's not what you'd call a glamorous man
Got one thing that's easily understood
He's the one they call Dr. Feelgood

which is great! but if I run the second formula (\r\n){3,} on the original file with the double line spacing I get a result like this..... unwanted result
Acting like a maniac

Whiplash
Bang your head against the stage
Like you never did before
Make it ring Make it bleed
Make it really sore
In a frenzied madness
with your leather and your spikes
Heads are bobbing all around
It is hot as hell tonight
Adrenaline starts to flow
You're thrashing all around
Acting like a maniac
Whiplash
Here on the stage the Marshal noise
is piercing through your ears
It kicks your ass kick your face
Exploding feeling nears
Now is the time to let it rip
To let it fuckin' loose
We are gathered here to im and kill
Cause this is what we choose
Adrenaline starts to flow
You're thrashing all around
Acting like a maniac
Whiplash
The show is through the metal is gone
It is time to hit the road
Another town Another gig
Again we will explode
Hotel rooms and motorways
Life out here is raw
But we will never stop
We will never quit
cause we are Metallica
Adrenaline starts to flow
You're thrashing all around
Acting like a maniac
Whiplash


I hope this explains it, I dont want to waste your time but I don't know much about formulas and regexp except it's confusing...LOL I realize the power in your script but more important I see that in my hands it is a dangerous script to use...LMAO all I can say is thank you for presets!


thank you for spending so much time trying to get me straightened out on this, I really appreciate it
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Post by ZvezdanD »

Muther wrote:if I run the second formula (\r\n){3,} on the original file with the double line spacing I get a result like this..... unwanted result
I don't think so. You could get such result only with the first preset example: (\r\n){2,} and $1. Anyway, now I understand your situation. Your two examples require two different approaches with different presets. As you already tried, second example with multiple lines could be solved with my second preset. For the first example with double lines you should try following settings:
Find what:

Code: Select all

(\r\n)(\r\n)
Replace with:

Code: Select all

$1
thank you for spending so much time trying to get me straightened out on this
No problem at all. I just wanted that you spend same amount of time to explain me better your intention. You know, good formed question is same as half of the answer.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Post by ZvezdanD »

Diabolic-Destiny wrote:just ignore the remix thing i figured it out
Here is the Replace with string for the second step, so you don't need to convert (remix) to [Remix] with a new preset, i.e. third example is already resolved with the second step:

Code: Select all

IIf(Right("$1", 7) = "(remix)", Left("$1", Len("$1") - 7) & "[Remix]", "$1")
You should check VBScript expression for this.
Muther
Posts: 27
Joined: Thu Jun 05, 2008 3:47 pm

Post by Muther »

No problem at all. I just wanted that you spend same amount of time to explain me better your intention. You know, good formed question is same as half of the answer.
I try not to waste smart peoples time with a lot of reading.....LMAO in the future I'll try to make my questions more informative. :) but you can see the problem ...... if I'm not even smart enough to ask the question right, there is no way I can figure out the answer.... LMAO :roll: :lol:
Muther
Posts: 27
Joined: Thu Jun 05, 2008 3:47 pm

Post by Muther »

ZvezdanD -

Would it be a major pain to add a check box to select the files to be changed and then have them all run at once?

I don't know anything about scripts so I have no idea but if it is time consuming and I could help in any way, I would. I think it be a good improvement. I'm going through all my lyrics and (the new formula is working well by the way) for some reason it finds a lot more files than just the "double line space ones" (I think is is catching all of them because of the empty lines between the phrases that I want to keep)

I have it set to display 50 files and as I go through and change the ones I want to change (say 5 or 6 in the batch of 50) I have to scroll down because it resets when I hit replace. I cant hit "replace all" because that isn't what I want but if I could scroll the list of 50 and check a box then hit a button that says "replace checked" I could go do something else for a few minuts cause it takes a bout 10 to 15 seconds every time I hit replace.


Just a thought.... maybe for a version upgrade or something?
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Post by ZvezdanD »

Muther wrote:Would it be a major pain to add a check box to select the files to be changed and then have them all run at once?
Well, I though about that, but I am not sure if it could be possible, or at least it would take too much time to implement it.

I think that you have a very easy alternative for this. You could click on the Keep Matched or Keep to Replace, and after that you will be returned to the main window with removed all tracks that not match your criteria (Keep Matched) or with all tracks which wouldn't be replaced if you choose Replace All command (Keep to Replace). Don't be afraid, tracks are removed only from the tracklist panel, not from the database. In the tracklist panel of the main window you could manually deselect all tracks which you don't want to be replaced with a help of Ctrl+left_click, and after that enter in the RegExp dialog box again. Then you could click Replace All without worrying that there are some tracks which shouldn't be replaced.
I have it set to display 50 files and as I go through and change the ones I want to change (say 5 or 6 in the batch of 50) I have to scroll down because it resets when I hit replace.
Well, this is a reason why I choose to display only 35 tracks by default - this is optimal for 1280x1024 resolution of the screen, without a need for vertical scroll. But, even if you have the table with more rows than could be displayed, you always have a current track displayed in the Original, Replacement and Result fields, so you don't need to scroll down the table to see the effect of the replacement on this track.
I could go do something else for a few minuts cause it takes a bout 10 to 15 seconds every time I hit replace.
Eh, this is really too much. How big is your database? Maybe you could try with Files / Maintain Library / Compact database, but before that you should make a backup of the database file.
Muther
Posts: 27
Joined: Thu Jun 05, 2008 3:47 pm

Post by Muther »

ZvezdanD wrote: Well, this is a reason why I choose to display only 35 tracks by default - this is optimal for 1280x1024 resolution of the screen, without a need for vertical scroll. But, even if you have the table with more rows than could be displayed, you always have a current track displayed in the Original, Replacement and Result fields, so you don't need to scroll down the table to see the effect of the replacement on this track.
I have to scroll a lot cause it is showing the whole lyric file in the display. I can use it this way not too much of a pain. it was just a thought and it would be nice...:)

as the script is now, it will save me a whole lot of time.

Thanks again

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

Post by ZvezdanD »

Muther wrote:I have to scroll a lot cause it is showing the whole lyric file in the display. I can use it this way not too much of a pain. it was just a thought and it would be nice...:)
There is a new version of this script (2.2) which has a possibility to check which tracks you want to replace.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.1 - with 50 presets [MM2+3]

Post by ZvezdanD »

There is a new release (2.2.1).
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.1 / 5.4.1  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.8 / 4.0.1  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.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Muther
Posts: 27
Joined: Thu Jun 05, 2008 3:47 pm

Re: RegExp Find & Replace 2.2.1 - with 50 presets [MM2+3]

Post by Muther »

ZvezdanD wrote:There is a new release (2.2.1).
I get an error "file not found" when installing the new script.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.1 - with 50 presets [MM2+3]

Post by ZvezdanD »

Muther wrote:I get an error "file not found" when installing the new script.
Sorry, there is a fixed revision (2.2.2).
Muther
Posts: 27
Joined: Thu Jun 05, 2008 3:47 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by Muther »

That was quick!..... but I get this error
access violation at address 00642877 in module 'mediamonky.exe' Reed of address 0000000
but it then says install successful.... but it only showed 43 presets, so I did an uninstall and a re install (Same error) but it did work. I now see 50 presets and the script seems to be working fine.

I did just upgrade to the latest greatest MedidaMonkey, (3.0.3.1183) don't know if this has anything to do with it but thought I'd mention it.
gege
Posts: 866
Joined: Tue Sep 05, 2006 2:10 pm
Location: Brazil

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by gege »

ZvezdanD, I was trying to put together a regexp to "Remove leading and trailing lines from the Lyrics" in one single step, but unfortunatly I wasn't able to.
Though, I DID achieve my goal splitting the process into two steps:

Code: Select all

Step1: "Remove leading lines from the Lyrics" 
Find what: ^(\s*\r\n)+
Into: Lyrics
Regular expression 1: <checked>
Replace with: <empty>

Step 2: "Remove trailing lines from the Lyrics" 
Find what: (\s*\r\n)+$
Into: Lyrics
Regular expression 1: <checked>
Replace with: <empty>
Now I ask: is it possible to write down a regexp that will do the job in one single step?
I've tried things like this below, with no luck...

Code: Select all

Find what: ^(\s*\r\n)*(.*?)(\s*\r\n)*$
Into: Lyrics
Regular expression 1: <checked>
Replace with: $2
Another thing: when saving the presets I used in Steps 1 and 2 above, I noticed that presets saved by the user don't retain the "Regular expression 1" (and possibly "Regular expression 2") state. When I load my custom presets, that checkbox always come unchecked, no matter the status it had when I saved the preset.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

Muther wrote:I get this error
access violation at address 00642877 in module 'mediamonky.exe' Reed of address 0000000
but it then says install successful.... but it only showed 43 presets, so I did an uninstall and a re install (Same error) but it did work. I now see 50 presets and the script seems to be working fine.
Vista UAC, user account with limited access, anti-virus or some HIPS? Do you get same error every time when you restart MM program?
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

gege wrote:Now I ask: is it possible to write down a regexp that will do the job in one single step?
I've tried things like this below, with no luck...

Code: Select all

Find what: ^(\s*\r\n)*(.*?)(\s*\r\n)*$
Into: Lyrics
Regular expression 1: <checked>
Replace with: $2
You have been very close. Here is the Find what string:

Code: Select all

^(\s*\r\n)+((?:.|\r\n)*)(\s*\r\n)+$
Another thing: when saving the presets I used in Steps 1 and 2 above, I noticed that presets saved by the user don't retain the "Regular expression 1" (and possibly "Regular expression 2") state. When I load my custom presets, that checkbox always come unchecked, no matter the status it had when I saved the preset.
I don't know how this is possible. It works fine to me. In fact, all predefined presets I made in same way as you tried to do.
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.1 / 5.4.1  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.8 / 4.0.1  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.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Post Reply