# Selective Commas in Title

**URL:** https://community.mp3tag.de/t/selective-commas-in-title/71533
**Category:** Support
**Created:** [June 29, 2026, 4:42pm UTC](https://community.mp3tag.de/t/selective-commas-in-title/71533 "2026-06-29T16:42:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [June 29, 2026, 4:42pm UTC](https://community.mp3tag.de/t/selective-commas-in-title/71533/1 "2026-06-29T16:42:42Z")

</div>

Hello. I have successfully found a regex that works at regex101 but does not work as expected in Mp3Tag. (Test Data at the end of post.) I want to catch (and remove) any comma that does not meet the conditions below which is why I've used negative lookahead.

Regex:

```auto
,\s(?!\w+$)(?!\(\w+)(?!The\s\(.+\))

```

```auto
(?!\w+$) REM Exclude "Something, The"

```

```auto
(?!\(\w+) REM Exclude Some Text, (Other Text)

```

```auto
(?!The\s\(.+\)) REM Exclude "Something, The (More Text)"

```

Summary of conditions:

NOT Some Text, (Other Text) [e.g. Is This The Way To, (Amarillo)]

NOT Something, The [e.g. Way, The]

NOT Something, The (More Text) [e.g. Way, The (Extended Remix)]

NOT Text, (More text here) (With other text here) [e.g. Devotion, (I Wanna Give You) (12 Inch Mix)]

In the test data, it should catch only commas in the **bold** text (1 and 2), whilst excluding the others (3,4 & 5):

1. **When The Going Gets Tough, The Tough Get Going**
2. **This is it, I'm Done**
3. Some Text, (Other Text)
4. Something, The
5. Something, The (Extended Remix)

I'll keep working on it. Thank you

---

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [June 29, 2026, 5:26pm UTC](https://community.mp3tag.de/t/selective-commas-in-title/71533/2 "2026-06-29T17:26:58Z")

</div>

I've managed to simplify and get Mp3 Tag to do as required here with the following:

```auto
,(?=\s(?!\(|The))

```

I believe my previous error may have been the exclusion of an equals sign. Let me know. Thanks

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [June 30, 2026, 9:37am UTC](https://community.mp3tag.de/t/selective-commas-in-title/71533/3 "2026-06-30T09:37:17Z")

</div>

For future readers:

The above regular expression matches a comma only if:

1. it is followed by a space, and
2. the next string after the space is neither `(` nor `The`.

More technical:

1. `,` -\> it matches a literal comma.

2. `(?= ... )` → positive lookahead, this means the comma is only matched if what follows satisfies a condition, but without consuming those characters.

Inside the lookahead: `\s(?!\(|The)`

1. `\s` -\> after the comma, there must be a whitespace character (e.g. a space).

2. `(?!\(|The)` → negative lookahead -\> immediately after that whitespace, it must NOT be:  
`(` (an opening parenthesis), or  
`The`

---

<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: [July 7, 2026, 9:37am UTC](https://community.mp3tag.de/t/selective-commas-in-title/71533/4 "2026-07-07T09:37:25Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
