# $regexp(%TITLE%,\[^0-9a-zA-Z\],) does not work

**URL:** https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445
**Category:** Mac
**Created:** [February 23, 2022, 11:02am UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445 "2022-02-23T11:02:33Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Bernd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@Bernd](https://community.mp3tag.de/u/Bernd)
#### Post date: [February 23, 2022, 11:02am UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/1 "2022-02-23T11:02:33Z")

</div>

Hi,  
to exlude all NON-alphanumeric characters from TITLE, the above regex-command should work but it always gives me a Invalid regular expression.

What's wrong with that?

---

<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: [February 23, 2022, 11:21am UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/2 "2022-02-23T11:21:24Z")

</div>

If I try it with the Convert Tag -\> Tag (to see the result in the preview - green box) I don't see any error:

![image](https://community.mp3tag.de/uploads/default/original/2X/4/459701041149d126064b777816d79d3ae0e18270.png)

Could you please show us with a [screenshot](https://community.mp3tag.de/t/hints-for-asking-support-requests/56190#use-screenshots-to-exemplify-the-issue-2) where do you get the "invalid regular expression" error message?

BTW:  
The regular expression itself should be something like  
`$regexp(%TITLE%,'[^0-9a-zA-Z]', )`  
to get  
 ![image](https://community.mp3tag.de/uploads/default/original/2X/3/3f7056ffd26f82d11526f1de8e4f215b5f4890b4.png)

---

<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: [February 23, 2022, 11:38am UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/3 "2022-02-23T11:38:14Z")

</div>

To support @lyricslover:  
`$regexp(%TITLE%,'[^0-9a-zA-Z]',_)`  
turns  
"Class of '96 [Rev. Mix]" into  
"Class\_of\_\_96\_\_Rev\_\_Mix\_"  
(which also transforms the space)  
or use this:  
`$regexp(%TITLE%,'[^0-9a-zA-Z]',_)`

---

<div class="post-metadata">

### Author: ![Bernd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@Bernd](https://community.mp3tag.de/u/Bernd)
#### Post date: [March 2, 2022, 8:36am UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/4 "2022-03-02T08:36:01Z")

</div>

Thank you a lot for yout replies!  
I already build a workaround with using a TEMP-field and the RegEx-quickaction.  
Anyway, here's, what happens on mac:

 ![Bildschirmfoto 2022-03-02 um 09.29.47](https://community.mp3tag.de/uploads/default/original/2X/1/1c0229dce89db76d60c461ed3e30fe2fd7691902.jpeg)

---

<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: [March 2, 2022, 8:40am UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/5 "2022-03-02T08:40:00Z")

</div>

> [@Bernd](#):
>
> Anyway, here's, what happens on mac:

Oh,this is an observation on the Mac?!  
Did you follow the description in the documentation?

> [@Quick Actions and Action Groups](https://community.mp3tag.de/t/quick-actions-and-action-groups/51882):
>
> Mp3tag for Mac provides a variety of Actions, which can be used on filenames and tags. The actions can be applied individually via Actions → Quick Actions ⌥⌘ 6 or be grouped into named and reusable Action Groups via Actions → Actions ⌘ 6. Action Groups serve as repeatable workflows in Mp3tag for Mac. When using Quick Actions you can select one of the different available action types from the list. This action will be applied to the selected files and the changes are saved immediately. Tip 1…

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 2, 2022, 9:09am UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/6 "2022-03-02T09:09:29Z")

</div>

The documentation on [Scripting Functions](https://community.mp3tag.de/t/scripting-functions/51689) states for `$regexp`:

> Please note that you have to escape comma and other special characters in expr.

So the most easiest way would be to just enclose the expression in ' (given that [and] are special characters in Mp3tag's [Format Strings and Available Placeholders](https://community.mp3tag.de/t/format-strings-and-available-placeholders/51688))

`$regexp(%TITLE%,'[^0-9a-zA-Z]',)`

---

<div class="post-metadata">

### Author: ![Bernd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@Bernd](https://community.mp3tag.de/u/Bernd)
#### Post date: [March 2, 2022, 2:54pm UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/7 "2022-03-02T14:54:49Z")

</div>

Thanks a lot, Florian! This works like a charm... 👍

---

<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: [April 1, 2022, 2:55pm UTC](https://community.mp3tag.de/t/regexp-title-0-9a-za-z-does-not-work/56445/8 "2022-04-01T14:55:40Z")

</div>

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