# Regular expression help

**URL:** <https://community.mp3tag.de/t/regular-expression-help/18222>\
**Category:** Support\
**Created:** [September 6, 2016, 10:08am UTC](https://community.mp3tag.de/t/regular-expression-help/18222 "2016-09-06T10:08:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MillmoorRon](https://community.mp3tag.de/user_avatar/community.mp3tag.de/millmoorron/32/6888_2.png) [@MillmoorRon](https://community.mp3tag.de/u/MillmoorRon)\
**Post date:** [September 6, 2016, 10:08am UTC](https://community.mp3tag.de/t/regular-expression-help/18222/1 "2016-09-06T10:08:39Z")

</div>

I am trying to do a regular expression subsitution to captalise a list of acronyms (when they are not part of another word) with the following action:

[#0]  
T=4  
F=\_TAG  
1=(^|[^a-zA-Zds])(xxx|yyy|zzz)([^a-zA-Zds]|$)  
2=$1$upper($2)$3  
3=0

but, for example, xxx/yyy/zzz becomes XXX/yyy/ZZZ but I want XXX/YYY/ZZZ.

Alternate 'matches' are skipped.

Does anyone know a way of achieveing this?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [September 6, 2016, 4:11pm UTC](https://community.mp3tag.de/t/regular-expression-help/18222/2 "2016-09-06T16:11:43Z")

</div>

When I put your example and expression into the tag-tag converter like this:  
$regexp('xxx/yyy/zzz','(^|[^a-zA-Zds])(xxx|yyy|zzz)([^a-zA-Zds]|$)',$1$upper($2)$3)

the result is  
xxx/yyy/zzz  
which I think means that there is no match at all.

on the other hand  
$regexp('xxx/yyy/zzz','(^.\*$)',\u\u$1)  
produces  
"XXX/YYY/ZZZ"

---

<div class="post-metadata">

**Author:** ![Rijkstra](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rijkstra/32/22_2.png) [@Rijkstra](https://community.mp3tag.de/u/Rijkstra)\
**Post date:** [September 6, 2016, 5:04pm UTC](https://community.mp3tag.de/t/regular-expression-help/18222/3 "2016-09-06T17:04:29Z")

</div>

> [@MillmoorRon](#):
>
> I am trying to do a regular expression subsitution to captalise a list of acronyms (when they are not part of another word) with the following action:
> 
> [#0]  
> T=4  
> F=\_TAG  
> 1=(^|[^a-zA-Zds])(xxx|yyy|zzz)([^a-zA-Zds]|$)  
> 2=$1$upper($2)$3  
> 3=0
> 
> but, for example, xxx/yyy/zzz becomes XXX/yyy/ZZZ but I want XXX/YYY/ZZZ.
> 
> Alternate 'matches' are skipped.
> 
> Does anyone know a way of achieveing this?

This worked for me:

_Action type:_ **Replace with regular expression**  
_Field:_ **\_TAG**  
_Regular expression:_ **(^|[^A-Z])(xxx|yyy|zzz)([^A-Z]|$)**  
_Replace matches with:_**$1$upper($2)$3**

[] case-sensitive comparison

You don't need any of those lower-case letters in the classes when case-sensitive is unchecked. The inclusion of "ds" is puzzling since it is included in "a-z". You might try this simplified RegEx that might work depending on what your word boundaries are:

_Action type:_ **Replace with regular expression**  
_Field:_ **\_TAG**  
_Regular expression:_ **\b(xxx|yyy|zzz)\b**  
_Replace matches with:_ **$upper($1)**

[] case-sensitive comparison

The simple version has the added advantage that you can include acronyms with numbers like "y2k"-\>"Y2K" without adding them to your classes.

---

<div class="post-metadata">

**Author:** ![MillmoorRon](https://community.mp3tag.de/user_avatar/community.mp3tag.de/millmoorron/32/6888_2.png) [@MillmoorRon](https://community.mp3tag.de/u/MillmoorRon)\
**Post date:** [September 7, 2016, 6:12am UTC](https://community.mp3tag.de/t/regular-expression-help/18222/4 "2016-09-07T06:12:47Z")

</div>

> [@ohrenkino](#):
>
> When I put your example and expression into the tag-tag converter like this:  
> $regexp('xxx/yyy/zzz','(^|[^a-zA-Zds])(xxx|yyy|zzz)([^a-zA-Zds]|$)',$1$upper($2)$3)

Sorry, it was a "replace with regular expression" Action I was doing.

> [@Rijkstra](#):
>
> This worked for me:
> 
> _Action type:_ **Replace with regular expression**  
> _Field:_ **\_TAG**  
> _Regular expression:_ **(^|[^A-Z])(xxx|yyy|zzz)([^A-Z]|$)**  
> _Replace matches with:_**$1$upper($2)$3**
> 
> [] case-sensitive comparison
> 
> You don't need any of those lower-case letters in the classes when case-sensitive is unchecked. The inclusion of "ds" is puzzling since it is included in "a-z".

I didn't think of that! The 'ds' was a typo left over from many edits!

> [@Rijkstra](#):
>
> You might try this simplified RegEx that might work depending on what your word boundaries are:
> 
> _Action type:_ **Replace with regular expression**  
> _Field:_ **\_TAG**  
> _Regular expression:_ **\b(xxx|yyy|zzz)\b**  
> _Replace matches with:_ **$upper($1)**
> 
> [] case-sensitive comparison
> 
> The simple version has the added advantage that you can include acronyms with numbers like "y2k"-\>"Y2K" without adding them to your classes.

That seems to do the job!

Thanks all.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [September 7, 2016, 6:18am UTC](https://community.mp3tag.de/t/regular-expression-help/18222/5 "2016-09-07T06:18:13Z")

</div>

> [@MillmoorRon](#):
>
> Sorry, it was a "replace with regular expression" Action I was doing.  
> ...

I know.  
Yet, you can use the Tag-Tag-Converter plus the $regexp-command to test a regular expression as you get a preview.

---

<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:26pm UTC](https://community.mp3tag.de/t/regular-expression-help/18222/6 "2026-02-09T12:26:24Z")

</div>

Closed on February 9, 2026, 12:26pm UTC


