[Privoxy-users] 8.4.2. The Path Pattern

Lee ler762 at gmail.com
Fri May 12 15:09:16 UTC 2017


Hi,

On 5/11/17, privoxy at secmail.pro <privoxy at secmail.pro> wrote:
> Manual 842 ".example.com/(.*/)(ads|banners?|junk)"
>
> above example didn't work as expected.
> Privoxy didn't block below requests(".mycompany.com" will work though)
>
> ===
> http://testing.mycompany.com/aaa/something?try=HELLOy
>
> ===
> Action file:
> .mycompany.com/(.*/)(HELLO)
> ===
>
> Tried:
> .mycompany.com/(.*/)(HELLO)
> .mycompany.com/*HELLO*
> .mycompany.com/(.*/)(try)
> .mycompany.com/(.*/)(thing)
>
> Why is this?

Because the documentation is wrong & you don't understand how privoxy
does regular expressions?

What the docs should say is something like:

.example.com/(.*/)?(ads|banners?|junk)
  This regular expression will match any path of "example.com" that
starts with any of the words "ads", "banner", or "junk".

emphasis on >>starts with<<

www.example.com/foo/ads.php
  matches because "ads" comes right after a "/"
www.example.com/foo/myads.php
  does not match because there is no "ads", "banner" or "junk"
immediately following a /

If you want to match a string anywhere in the path you'll need a
leading "match anything" pattern (.*)

Given you want to block
  http://testing.mycompany.com/aaa/something?try=HELLOy
you could do something like
  .mycompany.com/.*try=HELLO
or if "HELLO" is enough to make you want to block
  .mycompany.com/.*HELLO

Regards,
Lee


More information about the Privoxy-users mailing list