How and where specify an "expression matching on URL"

Hi to all guys! I’m new.
First of all I apologize to open a new topic for a “stupid” issue!
For sure there is something wrong with me, but I don’t understand how to manage my own expressions
to filter specific words inserted inside URLs.
Inside Web Content Filter - General tab, I can enable expression option but it’s not so clear to me where
i have to put the words I want to block.
In my situation, I need to block all pages that contains the string “you” inside the url (for example …youtube…or …apptoyou…, etc.).
Thank you for your help!

1 Like

The syntax is based on SquidGuard configuration file:

Thank you Giacomo!
I knew that page and yes, it suggests how to set the expressions.
My question was: is it possible to put the strings needed, directly on GUI. If yes, where?
Seems quite strange that exist an option to enable the feature but not a place where to configure it.
I need to set only my few Global “strings” that matches on urls.
If it’s possible to set them via terminal (command line) only, could be a solution for me but
isn’t NS structure built around templates?
So finally I don’t know which one I should modify!
If I manually create a file “expressions” in /var/squidGuard/blacklists/custom/blacklist
it doesn’t work and as you know better than me the folder is going to be overwritten.
I found 2 topics on this forum, partially related to this problem but without a solution.
Where I’m wrong?
Thank you again for your patience.

Bye, Manuel

Probably now I better understand your needs.

You can expand the builtin expression filter which is a special category saved here: /var/squidGuard/blacklists/custom/builtin/expressions

Just add a fragment to the template-custom:

mkdir -p /etc/e-smith/templates/var/squidGuard/blacklists/custom/builtin/expressions/
echo "yourexpression" > /etc/e-smith/templates/var/squidGuard/blacklists/custom/builtin/expressions/30myexp
signal-event nethserver-squidguard-save

Simply put your expressions inside 30myexp.
You can start by copying already builtin expressions:


Hi Giacomo.

I appreciate so much your kindness and support! Actually I’ve obtained the same
result in a simpler way, by editing directly the template


Both solutions work but I think the real issue is another!
On NS server manager (I’m using ver. 6.8), we have two different places where activate
“expressions filtering”.
The first, that I consider “main” or “global”:

And the second one that sound to me “specific” for porn expressions (as the description says

In my tests, I understood that the template above (or the whole of the related template
segments, that is more correct), refers only to the second “specific” check box
inside the Filter tab (if enabled).
When I activate that option, expressions list based on porn entries is going to
be activate successfully.

So, if I want to create my own list of expressions and use ONLY them, the only
way to troubleshoot is to completely remove the content of each fragment that
creates the chain (I’m talking about the content of template files: “10base”
and “20banned_italian”) and replace their content (in one file at least) with
my specific expressions ONLY.

Basically I’m going to use a template that I suppose wasn’t originally thought
to manage customized values!
In other words, someone would like to keep browsing porn sites without any specific
limitation (by disabling the related flag), but in the same time want to block GLOBALLY
only specific expressions (by enabling the related flag inside General tab).

Finally, the fact is that I still don’t understand what the first main option “Enable
expression matching on URL” stands for, considering that seems to work only the other one inside the edit page of Filter tab (the “porn” one).

May I speculate a structural missing concerned the Global expressions
inside General tab, or is it thought to do something else that I ignore?

Please, keep in mind that issue doesn’t compromise my operation at al!!! :wink:.
I simply had a hamletic doubt about working conditions and usability of the
feature above.

Another “potential” missing (but for sure it’s only an idea): why don’t implement a blocked Urls /
Expressions, inside “Custom categories” also?

Thank you so much for your attention!

Waiting for you comment (don’t worry, absolutely if and when you have time), I wish you a
great day!



Right. :wink:

Some blacklists may contain list of expression lists, the checkbox enables it.

Even if this sounds as a good idea, but how can we validate the user input?
And how many users really know how to write regular expression ?:smiley:

1 Like

OK! Now I just know :cry: :cry: :cry:

:confused: :confused: :confused: :confused: Ok but if I can suggest, maybe it’s better to specify more
clearly on official manual and in-line Help what this button does :slight_smile:

For “validate” you mean be sure that the entry is correctly inputed?
I guess that “doesn’t matter”: If someone do a mistake confirming a input, the feature simply doesn’t work correctly, so the user will debug from itself what is going wrong. For the expressions and their sintax you could be right but consider that:

  • This is a Server OS with Server features, so it will be configured from someone who knows a little bit about
  • It seems to me not so absurde to read “instructions” on how to set correctly an expression on SquidGuard!
    I mean: I’m only a stupid admin without any ability on programming and I can reach the target anyway…so basically if “I CAN”, “ALWAYS CAN”. By the other side, “avoiding” the opportunity to set custom values (also using command line), sounds too restricted to me. If you can accept my suggestion, please consider to adopt this option in future releases of this great distro!

Thanks so much to you and all the team, for your support and great job!
We could set this topic as “closed”.


You are the man.