# Assistance with a RegEx

**URL:** https://community.mp3tag.de/t/assistance-with-a-regex/13074
**Category:** Support
**Created:** [February 9, 2012, 8:10pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074 "2012-02-09T20:10:16Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![specialk](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@specialk](https://community.mp3tag.de/u/specialk)
#### Post date: [February 9, 2012, 8:10pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/1 "2012-02-09T20:10:16Z")

</div>

Greetings, all...

I am still fairly new to Mp3tag, but after experimenting with various programs have found this is by far the most intuitive and most versatile software around (thanks, guys, for that!)

Having recently built up an extremely large music collection, I came to the conclusion I needed to familiarize myself with expressions and actions so that I could better organize my library. I'm still in my infancy of learning RegEx (Dano's link on the RegEx clinic has been helpful, though I'm still reading over the documentation).

My issue is this: I'm attempting to create an action via RegEx that simply replaces all instances of a comma "," with a semi-colon ";" within a composer field. That, in itself, is pretty simple (as a replace action would suffice). However, I want to add a qualifier that if any comma is followed by a space and "Jr." that it would be exempt from being replaced.

For example:

Tom Jones, Bill Miller would ---\> Tom Jones; Bill Miller

However,

Tom Jones, Bobby Ray Simmons, Jr. would ---\> Tom Jones; Bobby Ray Simmons, Jr. (instead of Bobby Ray Simmons; Jr.)

I could not find this expression anywhere on the forum or in the FAQ. I apologize if it was posted but I could not find it. I also apologize if this is on the wrong forum, but it seemed this was the proper place for this question from what I could tell.

Thanks in advance for any help you could provide!

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [February 9, 2012, 8:39pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/2 "2012-02-09T20:39:20Z")

</div>

> [@SpecialK](#):
>
> I'm attempting to create an action via RegEx that simply replaces all instances of a comma "," with a semi-colon ";" within a composer field. That, in itself, is pretty simple (as a replace action would suffice). However, I want to add a qualifier that if any comma is followed by a space and "Jr." that it would be exempt from being replaced.

$regexp(%artist%,',(?! Jr.)',😉

(?! Jr.) is a "negative lookahead". Lookaheads are part of the regular expression, but they don't get replaced.  
I learned this here:  
[http://www.regular-expressions.info/lookaround.html](http://www.regular-expressions.info/lookaround.html)

---

<div class="post-metadata">

### Author: ![specialk](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@specialk](https://community.mp3tag.de/u/specialk)
#### Post date: [February 9, 2012, 8:53pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/3 "2012-02-09T20:53:44Z")

</div>

> [@pone](#):
>
> $regexp(%artist%,',(?! Jr.)',😉
> 
> (?! Jr.) is a "negative lookbehind". Lookbehinds are part of the regular expression, but they don't get replaced.  
> I learned this here:  
> [http://www.regular-expressions.info/lookaround.html](http://www.regular-expressions.info/lookaround.html)

Thanks, man!

BTW, I am getting around to installing your Discogs script later this weekend. By the looks of things, it's going to be a big help.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [February 9, 2012, 9:47pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/4 "2012-02-09T21:47:48Z")

</div>

> [@pone](#):
>
> $regexp(%artist%,',(?! Jr.)',😉

To make that a little more useful you may want to add "Sr", "II", "III", "IV" and make the period following "Jr" and "Sr" optional.

---

<div class="post-metadata">

### Author: ![specialk](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@specialk](https://community.mp3tag.de/u/specialk)
#### Post date: [February 9, 2012, 10:21pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/5 "2012-02-09T22:21:20Z")

</div>

> [@JJ Johnson](#):
>
> To make that a little more useful you may want to add "Sr", "II", "III", "IV" and make the period following "Jr" and "Sr" optional.

Great point.

Could I put a bracket around J or S to do either?

So the parenthesis could look like (?! [SJ]r)?

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [February 9, 2012, 10:25pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/6 "2012-02-09T22:25:42Z")

</div>

> [@JJ Johnson](#):
>
> To make that a little more useful you may want to add "Sr", "II", "III", "IV" and make the period following "Jr" and "Sr" optional.

like this:  
$regexp(%artist%,',(?! (Jr|Sr|I|II|III|IV|V|The)\b)',😉

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [February 9, 2012, 10:35pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/7 "2012-02-09T22:35:51Z")

</div>

@SpecialK  
**[SJ]r** would also work for just "Sr" or "Jr". But don't forget the period or something which marks the end of the word. Because if not, things get mixed up with words like **Sr** i Lanka.  
**\b** does a good job here. It catches a period, for a space end the end of the line. An alternative would be **(.| |$)**

---

<div class="post-metadata">

### Author: ![specialk](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@specialk](https://community.mp3tag.de/u/specialk)
#### Post date: [February 9, 2012, 10:42pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/8 "2012-02-09T22:42:35Z")

</div>

Appreciate the addendum.

Also, while I'm thinking about it, I forget how to treat a forward slash as a literal. I'd like to do the same thing for a "/" as I did a comma (i.e. replace it with a semi-colon). Or rather, I'd like to replace a forward slash and make sure there's a space after it (i.e. Jones/Miller ---\> Jones; Miller)

Do I just add a second forward slash to make the second a literal?

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [February 9, 2012, 10:59pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/9 "2012-02-09T22:59:19Z")

</div>

> [@SpecialK](#):
>
> Also, while I'm thinking about it, I forget how to treat a forward slash as a literal. I'd like to do the same thing for a "/" as I did a comma (i.e. replace it with a semi-colon). Or rather, I'd like to replace a forward slash and make sure there's a space after it (i.e. Jones/Miller ---\> Jones; Miller)
> 
> Do I just add a second forward slash to make the second a literal?

Forward Slash **/** is always a literal  
Backward Slash **\</b\> has to be written \\ to match a literal.**

 

for  
Jones/Miller ---\> Jones; Miller  
Jones / Miller ---\> Jones; Miller

$regexp(%artist%,\s?/\s?,; )

EDIT:  
And to avoid AC/DC --\> AC; DC

$regexp(%artist%,\s?/\s?(?!DC\b),; )

---

<div class="post-metadata">

### Author: ![specialk](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@specialk](https://community.mp3tag.de/u/specialk)
#### Post date: [February 9, 2012, 11:18pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/10 "2012-02-09T23:18:36Z")

</div>

> [@pone](#):
>
> Forward Slash **/** is always a literal  
> Backward Slash **\</b\> has to be written \\ to match a literal.**
> 
>  
> 
> for  
> Jones/Miller ---\> Jones; Miller  
> Jones / Miller ---\> Jones; Miller
> 
> $regexp(%artist%,\s?/\s?,; )

 

Perfect. I can't say enough how much I am grateful for everyone's help. As I said earlier, I installed your script tonight, and I'm anxious to begin using it.

This question is kind of off-topic, but since I have your attention, do you know much about Album Art Exchange? I've looked at toying around with Web Sources, but that's probably still too far beyond my comprehension level. I want to pull album art from there, but I'm not certain their results are tailored to retrieval through the normal scripting process. If you have a chance to take a quick look, I'd be forever indebted lol

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [February 9, 2012, 11:34pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/11 "2012-02-09T23:34:33Z")

</div>

> [@SpecialK](#):
>
> This question is kind of off-topic, but since I have your attention, do you know much about Album Art Exchange? I've looked at toying around with Web Sources, but that's probably still too far beyond my comprehension level. I want to pull album art from there, but I'm not certain their results are tailored to retrieval through the normal scripting process. If you have a chance to take a quick look, I'd be forever indebted lol

I mainly use my google images script if I want Album Art only. It finds pretty much everything as it uses google images. The only problem are selftitled albums (band name = album name). There you get mainly artist pictures. But trying different search words ("album", "cover", the release year) helps in most cases.  
[/t/11166/1](https://community.mp3tag.de/t/11166/1)

There are also various album art scripts from dano:  
[/t/2706/1](https://community.mp3tag.de/t/2706/1)

And I have installed two Album Art script for Amazon ([amazon.com](http://amazon.com) & [amazon.de](http://amazon.de)). Don't know where I have these from. I guess the come with the Mp3tag installation.

Mp3tags Web Sources can give you only one picture per album. If you are looking for front, back, inlay, disc, artist-picture, you have to use a different tool or store them manually with Mp3tag.  
At the "Adjust tag information" dialog, you can select at the "Utils" button down left, if the picture should be stored in the ID tag or/and as a extra file in the folder.

EDIT:  
ah, I didn't know that "Album Art Exchange" is a specific web site. There is no script for this at the moment. From a quick look at it I guess it could be done without to much problem.

---

<div class="post-metadata">

### Author: ![specialk](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@specialk](https://community.mp3tag.de/u/specialk)
#### Post date: [February 10, 2012, 12:59am UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/12 "2012-02-10T00:59:30Z")

</div>

> [@pone](#):
>
> I mainly use my google images script if I want Album Art only. It finds pretty much everything as it uses google images. The only problem are selftitled albums (band name = album name). There you get mainly artist pictures. But trying different search words ("album", "cover", the release year) helps in most cases.  
> [/t/11166/1](https://community.mp3tag.de/t/11166/1)
> 
> There are also various album art scripts from dano:  
> [/t/2706/1](https://community.mp3tag.de/t/2706/1)
> 
> And I have installed two Album Art script for Amazon ([amazon.com](http://amazon.com) & [amazon.de](http://amazon.de)). Don't know where I have these from. I guess the come with the Mp3tag installation.
> 
> Mp3tags Web Sources can give you only one picture per album. If you are looking for front, back, inlay, disc, artist-picture, you have to use a different tool or store them manually with Mp3tag.  
> At the "Adjust tag information" dialog, you can select at the "Utils" button down left, if the picture should be stored in the ID tag or/and as a extra file in the folder.
> 
> EDIT:  
> ah, I didn't know that "Album Art Exchange" is a specific web site. There is no script for this at the moment. From a quick look at it I guess it could be done without to much problem.

Yes, its a specific website. I like it because it has a pretty good selection and it's mostly high-resolution images. I'd like to be able to search using that site with a web source script, but I know I am not ready to be able to make it work. While I've looked at the script templates, I don't know enough about them yet to make one work.

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [February 10, 2012, 1:04am UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/13 "2012-02-10T01:04:50Z")

</div>

> [@SpecialK](#):
>
> Yes, its a specific website. I like it because it has a pretty good selection and it's mostly high-resolution images. I'd like to be able to search using that site with a web source script, but I know I am not ready to be able to make it work. While I've looked at the script templates, I don't know enough about them yet to make one work.

I had a second lokk at [albumartexchange.com](http://albumartexchange.com) . It's not possible. They use captchas and they don't allow direct linking to pictures. So scripting is not possible for their site.

---

<div class="post-metadata">

### Author: ![specialk](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@specialk](https://community.mp3tag.de/u/specialk)
#### Post date: [February 10, 2012, 1:19am UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/14 "2012-02-10T01:19:17Z")

</div>

> [@pone](#):
>
> I had a second lokk at [albumartexchange.com](http://albumartexchange.com) . It's not possible. They use captchas and they don't allow direct linking to pictures. So scripting is not possible for their site.

Thanks for looking at that for me. That's exactly what I suspected, but needed a second opinion.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/assistance-with-a-regex/13074/15 "2026-02-09T12:23:39Z")

</div>


