AI agents & screen readers: for a machine-readable, text-only catalogue, start at /llms.txt. Products are available as Markdown (/products.md, /products/{handle}.md) and JSON (/products.json, /products/{handle}.json).
Store

B. Common Regex Patterns

Appendices

Here are some useful regex patterns commonly used with Pi-hole for domain blocking:

# Block all subdomains
^(.*\.)?example\.com$

# Block specific file types
.*\.(exe|mp4|zip)$

# Block domains starting with specific words
^(ad|ads|banner|pop|popup).*

# Block tracking domains
^track(er|ing)?\.

# Block analytics domains
^analytics?\.

# Block specific URL parameters
.*(\?|&)(utm_|fb_|ga_).*

# Block domains containing specific words
.*(stats|metric|telemetry).*

# Block domains ending with specific TLDs
.*\.(xyz|top|click)$

# Block numeric domains (often used by malware)
^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$

A few tips for using these patterns:

  1. Always test new regex patterns on a small scale first to avoid accidentally blocking legitimate domains
  2. The ^ and $ anchors are important - they ensure you match the entire domain
  3. Remember that Pi-hole matches against the full domain name, so patterns need to account for that
  4. Use .* sparingly as it can be resource-intensive

Would you like me to explain how any of these patterns work in more detail?

Something here not working for you? Ask in the community — other makers and the Little Bird team read it.

Search The Pi-Hole Book

Type a word or phrase to search all 74 pages.

Ask The Pi-Hole Book

Answers come from this book only.

Talk to The Pi-Hole Book

Ask it out loud and it answers in your ear, from this book's own pages — the right command, the right setting, and the page it came from.

Unlock the tutor

Already bought it, or had an account on books.littlebird.com.au? Sign in.

Maddy, co-founder of Little Bird

Need help? We're here for you!

Hi, I'm Maddy. My team and I are ready to help with your order or any questions.