Help - Search - Members - Calendar
Full Version: Removing an HTML Link from the Lyrics
Mp3tag Forums > Mp3tag - International > Support
warthogmadman987
New poster here, So please be patient with me.

I don't have a ton of scripting experience but am willing to learn.

I have a lot of lyrics that I had imported by some software. This software grabbed from some database that put an html link into the middle of the lyrics.

I have been trying to make an action using the Replace function as well as the Replace with regular expression function using the UNSYNCEDLYRICS field. The string I want to remove is contained in brackets. I'm just not getting it to work right. I've tried learning from some examples on this site, but have been unsuccessful. As an example, below is a cut and paste of a song:


Say after me,
“It's no better to be safe than sorry. ”
[ Lyrics from: http://www. Lyricsfreak. Com/a/a+ha/take+on+me_20001902. Html ]
Take on me (take on me)

Is there a way to remove the 3rd line?

Thanks for all your help.
ohrenkino
ZITAT(warthogmadman987 @ Apr 20 2012, 06:20) *
... As an example, below is a cut and paste of a song:


Say after me,
“It's no better to be safe than sorry. ”
[ Lyrics from: http://www. Lyricsfreak. Com/a/a+ha/take+on+me_20001902. Html ]
Take on me (take on me)

Is there a way to remove the 3rd line?

Thanks for all your help.

Create an action of the type Replace with regular expression for the field UNSYNCEDLYRICS.
Enter as search string:
(.*)\[.*\](.*)
enter as format string:
$1 $2
warthogmadman987
QUOTE (ohrenkino @ Apr 20 2012, 01:18) *
Create an action of the type Replace with regular expression for the field UNSYNCEDLYRICS.
Enter as search string:
(.*)\[.*\](.*)
enter as format string:
$1 $2



Thank You! Thank worked. Now I'm gonna have to try and figure out how it worked to understand.
ohrenkino
ZITAT(warthogmadman987 @ Apr 20 2012, 08:45) *
Thank You! Thank worked. Now I'm gonna have to try and figure out how it worked to understand.

Oh well: the dot means "any character".
The asterisk means "any number of it"
The round brackets mean "treat this as a unit" - these units in brackets can later be addressed by a numbered variable: the first set of bracket becomes $1, the second $2 etc ...
As the square bracket [ has a special meaning in the regular expressions but you want to tread it as a literal for the delimiter it has to be escaped with the backslash.
So in plain language the search string reads:
structure the whole of the filed into one part before an opening square bracket, one between and one following the closing square bracket and then transfer only the parts before an after back to the field.
stevehero
QUOTE (warthogmadman987 @ Apr 20 2012, 07:45) *
Thank You! Thank worked. Now I'm gonna have to try and figure out how it worked to understand.

Another way which might be safer is as looks for the 'html]' in the string and deletes everything inside the '[]'

Otherwise the one you have will delete [Anything inside square/closed brackets]

Action type: Replace with regular expression
Field: UNSYNCEDLYRICS
Regular expression: \[.+html[^]]\]
Replace matches with:
[ ] case-sensitive comparison

See attached jpeg for explanation.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.