Regex blocking does not work correctly


Hi, I am currently having a problem with a RegEx entry in my blacklist. When my regex pattern matches the domain name, it’s not being blocked.

Here is my regex pattern:


This pattern should block domains like:

And shouldn’t block domains like:

Expected Behaviour:

DNS domains that match the RegEx rule in blacklist should be blocked.

Actual Behaviour:

They’re being forwarded instead of blocked.

Debug Token:


Thank you.


When you run your regex pattern through Regex 101 (, it shows a full match for every domain you have listed.

I don’t think the regex you have written is correct for the patterns you wish to block and not block.

Also note that not every regex that passes Regex 101 checks will work with Pi-Hole properly, since Pi-Hole uses a specific set of regex rules (POSIX ERE). So, after you get your regex squared away on Regex 101, you will want to enable regex debug mode per the link below. This will trigger an entry in /var/log/pihole-FTL.log the first time each regex filter blocks a domain. You can use dig commands and see if your regex works with Pi-Hole.

1 Like

Ooops, there was a typo in the regex pattern, it should be r.+?---.*?-.*?(?<!-cune)\.googlevideo\.com. There is an error with the regex expression I wrote: ERROR compiling regex on line 2: Invalid preceding regular expression (13). How could I fix it? Im not familiar with POSIX ERE unfortunetly.


What is the output of:

cat /etc/pihole/regex.list


Currently I do not have acces to the server, however the line 2 of regex.list is the regex expression I talked about: r.+?---.*?-.*?(?<!-crune)\.googlevideo\.com


Something about that regex does not agree with Pi-Hole. The developers have more expertise in this area, so perhaps they will see the problem.

@DL6ER , @Mcat12


Negative lookbehind, (?<!), is not supported. FTL supports POSIX extended regex. More details here:

1 Like