Search code examples
javascriptregexhttpurladblock

Double pipe in front of URL - Regex?


Looking at URL listings for adblockers and seeing entries with double pipes preceding the URL:

||akamai.net^*.247realmedia.com/$third-party

Anyone know what these double pipes refer to? Thanks


Solution

  • This is not the RegEx but how AdBlock scripts use it.

    Quoting from https://adblockplus.org/en/filters, "Matching at beginning/end of an address" section

    Sometimes one wants to block http://example.com/banner.gif as well as https://example.com/banner.gif and http://www.example.com/banner.gif. This can be achieved by putting two pipe symbols in front of the filter which makes sure the filter matches at the beginning of the domain name: ||example.com/banner.gif will block all these addresses while not blocking http://badexample.com/banner.gif or http://gooddomain.example/analyze?http://example.com/banner.gif (requires Adblock Plus 1.1 or higher).

    From above, it's clear that two pipes || are used to match the beginning of domain.