Skip to contentSkip to conversation

squid regex

DISCUSSION Luca Ferrari 2 participants 4 messages May 12, 2005

lore
Share & tools
lore
#0 lore raw

Hi,
I cannot understand a thin about squid regex: are they regex in the "unix" meaning of the term? For example, the regex .rar will intercept only ".rar" or everything that ends with .rar, since there is the starting dot that catches any character?

Thanks,
Luca

Signature · 2 lines
Luca Ferrari,
[email protected]
#1 lore raw
Quoted 6 lines · Luca Ferrari

Hi,
I cannot understand a thin about squid regex: are they regex in the "unix" meaning of the term? For example, the regex .rar will intercept only ".rar"
or everything that ends with .rar, since there is the starting dot that catches any character?

RegEx can, and do, change with each application, however, most try to be like Perl or C RegEx. "UNIX" RegEx also depends on the shell and program, like grep, that you are using. So, to shorten your answer, you will need to learn the Squid RegEx, and that may even vary in the what you are trying to do with squid.

I have something a line like this for catching Windoze file extentions:
acl WinExecs url_regex -i \.exe \.bat \.dll \.zip \.gz \.scr \.rar \.wmv \.mov
http_access deny WinExecs

It works pretty well. I put the \. in there so it doesn't trigger on something like executive.html but would still trigger on blah.executive.html
*shrug* can't protect them all from teh entire world I guess.

Maybe \.rar$ would be a better RegEx, but then what if the URL ends like .rar?blah=blah... I'm not going to test it for you, you can do that.

Maybe that is what you are looking for?

--
Scott

#2 lore raw
Quoted 5 lines · On Thursday 12 May 2005 17:31 your cat walking on the keyboard wrote:

I have something a line like this for catching Windoze file extentions:
acl WinExecs url_regex -i \.exe \.bat \.dll \.zip \.gz \.scr \.rar \.wmv \.mov
http_access deny WinExecs

That answers my question, thus it seems as the dot works as I said, but I was unable to find information in the squid manual.

Thanks,
Luca

Signature · 2 lines
Luca Ferrari,
[email protected]
#3 lore raw
Quoted 9 lines · Luca Ferrari
Quoted 5 lines · On Thursday 12 May 2005 17:31 your cat walking on the keyboard wrote:

I have something a line like this for catching Windoze file extentions:
acl WinExecs url_regex -i \.exe \.bat \.dll \.zip \.gz \.scr \.rar \.wmv \.mov
http_access deny WinExecs

That answers my question, thus it seems as the dot works as I said,

Not really as you said, it doesn't have to end in '.rar' and the '.' could be filled with any character unless you escape it with a '\', thus '\.rar' but will still not only end in '\.rar' unless you tell it to check the end only by appending a '$' to the RegEx, like so '\.rar$'

Here it works mostly like RegEx in awk, sed and grep. :)

--
Scott