# Regex list discussion

**URL:** <https://discourse.pi-hole.net/t/regex-list-discussion/73528>\
**Category:** Customizing Pi-hole\
**Created:** [October 18, 2024, 6:50pm UTC](https://discourse.pi-hole.net/t/regex-list-discussion/73528 "2024-10-18T18:50:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [October 18, 2024, 6:50pm UTC](https://discourse.pi-hole.net/t/regex-list-discussion/73528/1 "2024-10-18T18:50:22Z")

</div>

Continuing the discussion from [Collection of RegEx for blacklisting](https://discourse.pi-hole.net/t/collection-of-regex-for-blacklisting/43178/26):

@Smolka_J I just skimmed over the list but found a few entries, I do not really understand, e.g.

> [@Collection of RegEx for blacklisting](https://discourse.pi-hole.net/t/collection-of-regex-for-blacklisting/43178/26):
>
> `(\.|^)*-alert*\.`

The first `*` means "any number of initial dots or line beginnings". This is not meaningful at all but makes the regex more costly to evaluate. Similarly for the second `*`, it means "match zero `t`s" as in "`-aler`", one `t` as in `-alert` or any number of `t`s like `-alerttttt`. I don't think this is what you want.

This is just an example for many similar things in there.

---

<div class="post-metadata">

**Author:** ![Smolka\_J](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/smolka_j/32/43785_2.png) [@Smolka\_J](https://discourse.pi-hole.net/u/Smolka_J)\
**Post date:** [October 18, 2024, 9:38pm UTC](https://discourse.pi-hole.net/t/regex-list-discussion/73528/2 "2024-10-18T21:38:42Z")

</div>

Thank you for the input. I agree this list needs some further review to make the most effective. I've just been combining what I could find from multiple blacklist related sources into one list, alphabetized, de-duplicated, and then over the last couple years removed most any entries I found that were creating excess false positive alerts, I'm not the original writer of them nor am I a regex expert. My main goal here was testing one lists syntax vs another from what I came across and getting regex alerts of any kind to pop more often than practically not at all like I was first was finding. Been running this list for over a year now without "needing" much edited or whitelisted and am always open to suggestions for improvements, still a work in progress and wanted to get a bigger list out there compared to most regex lists I found about that are just a dozen or two lines or less

---

<div class="post-metadata">

**Author:** ![rdwebdesign](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/rdwebdesign/32/51363_2.png) [@rdwebdesign](https://discourse.pi-hole.net/u/rdwebdesign)\
**Post date:** [October 18, 2024, 10:23pm UTC](https://discourse.pi-hole.net/t/regex-list-discussion/73528/3 "2024-10-18T22:23:33Z")

</div>

Just be careful.  
In regex, the asterisk (`*`) is not a wildcard, but a dot (`.`) is. There are many other rules to learn.

> [@Smolka\_J](#):
>
> I'm not the original writer of them nor am I a regex expert.

Apparently you are adding regex entries that will block more than you expect.

Another example from your list:  
`((^)|(.))adchoice.`

The first dot will match any character once (not just a dot). The last dot will also match any character. Note: it could be simplified as `(^|.)adchoice.`

This will match any domains containing words with the following pattern: `_adchoice_` (where `_` is a letter, a digit, a dot, an hyphen or `_`).

- [regex101: build, test, and debug regex](https://regex101.com/r/aiVYAX/1)

* * *

I think the intention was to block only the domains and subdomains with `adchoice` between dots, like: `www.adchoice.com`.

In this case, your regex should be `(^|\.)adchoice\.`

---

<div class="post-metadata">

**Author:** ![Redback](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/redback/32/31264_2.png) [@Redback](https://discourse.pi-hole.net/u/Redback)\
**Post date:** [October 22, 2024, 4:38am UTC](https://discourse.pi-hole.net/t/regex-list-discussion/73528/4 "2024-10-22T04:38:08Z")

</div>

Here's some advice: it seems like you're using too many pantheist beliefs. For instance, using “[-_.]” or “[_.-]” in this example : “^banners?[-_.], ^banners?[_.-]” which is twice the same search load, which in turn produce the same single results. So, choose one and use it instead, I was able to check some of the regex in the list, coming up with the same result, hope this helps.
