# Third parameter broken for the regexpreplace fn

**URL:** https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653
**Category:** Web Sources Discussion
**Created:** [July 23, 2023, 10:25pm UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653 "2023-07-23T22:25:29Z")
**Posts on this page:** 8
**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: [July 23, 2023, 10:25pm UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/1 "2023-07-23T22:25:29Z")

</div>

@Florian, I had a spare 10mins to look into this as people were asking about the Traxsource scripts on my thread.

I think a bug has been introduced in the latest beta.

It's the third parameter here that I think is causing the issue. Removing it altogether and the scripts work but the function seems broken with the 3rd parameter.

These two lines are the issue in the scripts in the link that are on the Traxscourse Thread here.

```auto
regexpreplace "<a href=\"[^\"]+\" class=\"com-artists\" data-aid=\"([^\"]+)\">([^<]+)<\/a>" "<TrackArtistID=$1> <TrackArtistName=$2>" "<<endTrack>>"
regexpreplace "<span class=\"version\">([^<]+)<span class=\"duration\">\(([^\)]+)\)<\/span>" "<TrackMixName=$1><TrackLength=$2>" "<!--DIV artLinks-->"

```

> [@Traxsource web tag scripts](https://community.mp3tag.de/t/traxsource-web-tag-scripts/53011/4):
>
> Updated with the latest sctripts I am actually using : Single scripts haven't been changed but the Release version got added padded tracks numbers/Total tracks and prices. [https://drive.google.com/drive/folders/1GgAKI8lOBrTERzhc\_7o9u0sc3lxfBfc4?usp=sharing](https://drive.google.com/drive/folders/1GgAKI8lOBrTERzhc_7o9u0sc3lxfBfc4?usp=sharing)

---

<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: [July 24, 2023, 9:01am UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/2 "2023-07-24T09:01:41Z")

</div>

Can you be a little bit more specific?

1. Which of the various scripts in this package are you using?
2. What are the search inputs to trigger the issue? And most importantly,
3. What issues are you observing?

---

<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: [July 24, 2023, 2:27pm UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/3 "2023-07-24T14:27:41Z")

</div>

Sorry. Yes.

1. All of them are broken because the same fn is in them all.
2. Any search. It fails at the parsing album section as that's where the broken fns is.
3. Nothing is getting output to the tags as the two lines of code are making it fail. Comment these out and the script continues to work but those lines are required in order for them to work.

---

<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: [July 24, 2023, 5:34pm UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/4 "2023-07-24T17:34:46Z")

</div>

Seems like I'm not lucky with testing those scripts and I've already spent an insane amount of time trying to reproduce this.

Using "Traxsource Release Search by Artist - title" with "Doug Gomez Puro" gives no results and using "Traxsource Track search by artist-title" with "Doug Gomez Puro" gives a valid result including title and cover art.

Please just share what you are using to produce the error.

---

<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: [July 24, 2023, 7:49pm UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/5 "2023-07-24T19:49:18Z")

</div>

There also is no 3rd parameter for `RegexpReplace`

From [Developing Tag Sources – Mp3tag Documentation](https://docs.mp3tag.de/tag-sources/development/)

> Replaces everything that is matched by the [regular expression](https://docs.mp3tag.de/regex) in the first parameter by the string in the second parameter.

---

<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: [July 24, 2023, 9:42pm UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/6 "2023-07-24T21:42:27Z")

</div>

> [@Florian](#):
>
> There also is no 3rd parameter for `RegexpReplace`

Sorry, I should've spotted that. In which case there's no bug with Mp3tag.

It's just that users were reporting them stopping to work with one of the latest betas.

See here:

> [@Traxsource web tag scripts](https://community.mp3tag.de/t/traxsource-web-tag-scripts/53011/7):
>
> hi! seems that the problem is the version 3.21b because i try a backup version of 3.21 and it works. so i hope some update wil be release about it.

So not sure how they even worked in the first place.

---

<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: [July 25, 2023, 10:50am UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/7 "2023-07-25T10:50:36Z")

</div>

> [@stevehero](#):
>
> So not sure how they even worked in the first place.

I've checked this further and I had a one-off error in validating the function parameters in web sources scripts, so that those would never be checked.

With the latest additions I needed to extend the maximum number of parameters per function from 3 to 5, so that the 3rd parameter was now checked too. We also had this before in our conversation via PM where the superfluous parameter for `debug` suddenly caused problems.

To make life easier for all of us, I've now extended validation and also added reporting of syntax errors via an error message with [Mp3tag v3.21c](https://community.mp3tag.de/t/455).

---

<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: [July 26, 2023, 8:55pm UTC](https://community.mp3tag.de/t/third-parameter-broken-for-the-regexpreplace-fn/61653/8 "2023-07-26T20:55:32Z")

</div>

Thanks Florian. Sorry for sending you on a wild goose chase with this to begin with. I should've seen it was a RegexReplace fn and only 2 parameters should be there.
