# Using complex regexp in the new inlcude file

**URL:** https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893
**Category:** Web Sources Discussion
**Created:** [October 30, 2019, 12:07am UTC](https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893 "2019-10-30T00:07:34Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [October 30, 2019, 12:07am UTC](https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893/1 "2019-10-30T00:07:35Z")

</div>

@Florian, this is the contents of my `Beatport by &stevehero v5.0#RELEASE Search by Relea&Se.src` file.

```
[SearchBy]=Album search|$trim($regexp($regexp($regexp(%album%,\b-\b|_,' '),(?i)\[.*\]|cd\s*\d*|[^\s]+.com|\bep\b|feat\.|ft\.|\bom\b|\boriginal\b|\bclub\b|\bmix\b|\bremix\b|\bthe\b|vinyl|web|www[^\s]+|[^\w\s]|\b&*amp,),\s+,' '))|%s
[Include]=Beatport by &stevehero v5.0#Release Search.inc

```

It's returning an error even though that's a valid function:  
`[SYNTAX ERROR IN FORMATTING STRING]`

I'm trying to use this in its basic form: `Field Name|%field%|&query=%s.`

---

<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: [October 30, 2019, 8:41am UTC](https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893/2 "2019-10-30T08:41:22Z")

</div>

It's the naïve implementation that can't handle such complex expressions that have multiple `|` characters that should not be treated as separator (as in your regular expressions).

The implementation currently assumes that there is no `|` in any of the triplets and that the pipe characters is solely used as separator of those.

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [October 30, 2019, 9:48am UTC](https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893/3 "2019-10-30T09:48:28Z")

</div>

> [@Florian](#):
>
> The implementation currently assumes that there is no `|`

So, is this something that will be added in the future?

I do like the include function but could you reconsider my idea as an alternative to put these line(s) inside the `.scr` files themselves which will do the same thing and also limit the number of files. Instead of my beatport scripts having 18 files, I'll only have 4.

Link to that idea: [WSS Options: Choose which tag to search](https://community.mp3tag.de/t/wss-options-choose-which-tag-to-search/41334)

---

<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: [November 9, 2019, 5:19pm UTC](https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893/4 "2019-11-09T17:19:17Z")

</div>

> [@stevehero](#):
>
> So, is this something that will be added in the future?

I'll change the delimiter to be `||` with the next version. So far, only the official Discogs tag sources are affected and using two of the pipe symbols probably doesn't break with the complex regular expressions you're using. If you have any objections please let me know.

Regarding your other idea, I can see the value from the point of creating the tag sources. However, it would make the implementation even more complex and would mean a lot of work. Because I can't see a real benefit for the user — other than needing to copy fewer files — I'm putting that off for now.

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [November 10, 2019, 12:26pm UTC](https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893/5 "2019-11-10T12:26:36Z")

</div>

None at all, if it allows the or expression `|` in the include file for regex fn then that will be great.

Thanks for this Florian.

OK about the other, I just thought it was a nice idea to get the file cluter down in my sources folder and to limit the slightly unnecessary extra files 🙂

---

<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: [November 15, 2019, 11:02am UTC](https://community.mp3tag.de/t/using-complex-regexp-in-the-new-inlcude-file/46893/6 "2019-11-15T11:02:08Z")

</div>

I've changed the implementation to use two pipe symbols `||` as `SearchBy` delimiter for tag sources with [Mp3tag v2.99b](https://community.mp3tag.de/t/455).
