# How to remove apostrophes from search query w/ $regexp?

**URL:** <https://community.mp3tag.de/t/how-to-remove-apostrophes-from-search-query-w-regexp/17818>\
**Category:** Support\
**Created:** [April 4, 2016, 2:22pm UTC](https://community.mp3tag.de/t/how-to-remove-apostrophes-from-search-query-w-regexp/17818 "2016-04-04T14:22:20Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [April 4, 2016, 6:45pm UTC](https://community.mp3tag.de/t/how-to-remove-apostrophes-from-search-query-w-regexp/17818/6 "2016-04-04T18:45:12Z")

</div>

> [@ms6676749](#):
>
> Discogs throws up 401 errors with queries containing apostrophes. So, I try to strip apostrophes (and other offending characters) from my queries. Everything else but apostrophes are stripped. ...

You may try this formatstring ...

**$regexp(%ALBUM%,'(\s+\[.+\]$)|\x27|'$regexp('-\_.+!(){}[]^$~\*?,:\','.','|\\\\$0'),,1)**

... or ...

**$regexp(%ALBUM%,'(\s+\[.+\]$)|\x27|[^\w\s]',,1)**

DD.20160404.2306.CEST

---

_[View the full topic](https://community.mp3tag.de/t/how-to-remove-apostrophes-from-search-query-w-regexp/17818)._
