Regex help

Please follow the below template, it will help us to help you!

Expected Behaviour:

I am trying to wilcard match a set of domain names that look like “”. There’s an ad company out there with a zillion domain names such as:

I’d like to block them. I’ve entered a regex blacklist as follows:


When I test this regex with an online regex tester, it works as expected.

Actual Behaviour:

pihole doesn’t seem to interpret the regex the same way the online tester does and as a result, the domain names don’t get matched.

Any help would be appreciated.

Thank you,


Pi-Hole uses a specific variety of regex (POSIX ERE) and some of the regex that pass the tests at do not work in Pi-Hole, although they will compile.

For testing purposes, you can enable REGEX debug mode and any regex that are triggered with a domain request will be logged in /var/log/pihole-FTL.log

Thank you! That was perfect!

Don’t forget to have a look at the Pi-hole docs jfb referred to.

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