# I need help understanding $regex in mp3tag

**URL:** <https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085>\
**Category:** Support\
**Created:** [December 8, 2020, 9:38pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085 "2020-12-08T21:38:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moibilak7](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@Moibilak7](https://community.mp3tag.de/u/Moibilak7)\
**Post date:** [December 8, 2020, 9:38pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085/1 "2020-12-08T21:38:56Z")

</div>

Hi guys,  
I studied computer science but I seem to be totally misunderstanding regex in mp3tag. I mean, why is

`$regexp(%title%,([a-z])+,_)`

with  
`Drüg (feat. Emie)`

producing  
`_D_r_ü_g_ _(_f_e_a_t_._ _E_m_i_e_)_`  
???

I expected  
`D_ü_ ( ____. E___ )`

> `$regexp(x,expr,repl)` replaces the pattern specified by the regular expression `expr` in the string `x` by `repl`.

---

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [December 8, 2020, 9:45pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085/2 "2020-12-08T21:45:53Z")

</div>

You have to keep in mind the provided scripting language has its own syntax and special chars.  
It is recommended to put especially regex patterns in ' apostrophes so you don't have to escape each ( or [ character.  
Try `$regexp(%title%,'([a-z])+',_)`

---

<div class="post-metadata">

**Author:** ![Moibilak7](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@Moibilak7](https://community.mp3tag.de/u/Moibilak7)\
**Post date:** [December 8, 2020, 10:06pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085/3 "2020-12-08T22:06:19Z")

</div>

Thanks bud, I will try using apostrophes.

---

<div class="post-metadata">

**Author:** ![Moibilak7](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@Moibilak7](https://community.mp3tag.de/u/Moibilak7)\
**Post date:** [December 8, 2020, 10:09pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085/4 "2020-12-08T22:09:24Z")

</div>

Still no luck... I don't get it.  
`$regexp(%title%,'([A-Z][a-z]\xdc\xfc\d\s)+',_)`  
is producing nothing. Shouldn't `([A-Z][a-z]\xdc\xfc\d\s)+` select `Drüg`, `feat` and `Emie`?

Afaik `([A-Z][a-z])+` finds every word that consists of uppercase and lowercase letters ranging from a to z. But in mp3tag literally nothing gets found or replaced at all. What am I missing? I am losing my believe in myself.

I found the solution... I have to include the | `OR` operator: `$regexp(%title%,'([A-Z]|[a-z])+',_)`  
Now I can sleep in peace.

---

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [December 8, 2020, 11:29pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085/5 "2020-12-08T23:29:29Z")

</div>

Maybe instead of `$regexp(%title%,'([A-Z][a-z]\xdc\xfc\d\s)+',_)`  
you meant  
`$regexp(%title%,'([A-Za-z\xdc\xfc\d\s])+',_)`  
Understand the difference  
`[A-Z][a-z]` vs `[A-Za-z]`

---

<div class="post-metadata">

**Author:** ![Moibilak7](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@Moibilak7](https://community.mp3tag.de/u/Moibilak7)\
**Post date:** [December 8, 2020, 11:32pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085/6 "2020-12-08T23:32:44Z")

</div>

The thing is that I tried that and didn't get to the solution I expected either. But I slowly begin to understand. However, thanks for your help.

---

<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:** [January 7, 2021, 11:32pm UTC](https://community.mp3tag.de/t/i-need-help-understanding-regex-in-mp3tag/51085/7 "2021-01-07T23:32:45Z")

</div>

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