Possible new feature; GUI to Regex?


I know this somewhat exists third-party (not built-into PiHole), but I feel like this would be a good feature to add, so that noobies (like myself) could better understand Regex, and use it more appropriately.


Are you looking for a tutorial on regex or a link to a regex site? How would you envision this feature being added to Pi-Hole?


Well, how about something with a similar layout to this?

The “Regular Expressions” get dragged to the “Regex URL” box (location of where it is placed in the box matters), and an example is shown in “Regex URL Example”.

The user also has the option of typing their own example into “Regex URL Example”, and if the example doesn’t match the “Regex URL” parameters, it turns red.

The URL portion is so that the user can input a custom URL, and see what other URL’s will get blocked, depending on the users inputted “Regular Expressions”

I hope that diagram and explanation all makes sense. It of course can be laid out much better, but I quickly drew it out and came up with it.

I tried to look online for a website or software that does what my diagram illustrates, but couldn’t find anything, and I really feel like if it was designed this way, people would learn Regex much easier (especially useful for PiHole)!

What’s your input on this @jfb

P.S. I know that Regex stands for “Regular Expressions,” I couldn’t think of a more appropriate thing to call it (since I am a noobie).


There’s already a few sites that do things a lot better than we ever could. Plus they link to or directly have vast tutorials to teach users how to write.



Regex is admittedly a dark art, there are many ways to write the same match. I just think this would do a disservice to our users as we could not put the necessary time to maintain the code.


Totally understandable. I guess this topic can be closed then, but before you do so, do you know if there are any websites/programs that teach Regex the way that I illustrated? I tried to look online for a website or software that does what my diagram illustrates, but couldn’t find anything. I feel like I’d personally be able to learn Regex really well with a layout like what I illustrated.


https://regexper.com/ is a site that draws your regex and gives a easy acces to its workings.

Together with regex101 these two are the ones I use.

Look at this one:(^|\.)google\.com$

Remember to anchor the regex at the beginning (^) or the end ($) to avoid suprising outcomes.


Thanks everyone. This can be closed :slight_smile:


Just be aware that even if a regex appears to be valid in one of the test sites, it won’t necessarily work in Pi-Hole due to the version of regex that Pi-Hole supports (POSIX ERE).

The sure way to test a regex on your Pi-Hole is to enable REGEX_DEBUGMODE (https://docs.pi-hole.net/ftldns/configfile/), then add the regex and test the regex with a dig command and see if the compiled regex on your Pi-Hole blocks it.