FAQ: Can I block pages that contain specific words or phrases?

The tilde prefix (~) can be used to restrict blocking to pages that contain given keywords. Within a keyword you can use an asterisk (*) to match any number of characters (except whitespace) and an underscore (_) to match whitespace. Note that the keyword matching is case-insensitive (i.e., uppercase and lowercase are treated as equivalent).

So, for example, you could enter the following into the list of sites:

somesite.com
anothersite.com
~anteaters
~crypto*
~*alicious
~green_eggs_and_ham

This would result in pages on the sites somesite.com and anothersite.com being blocked only when those pages contain the complete word “anteaters” or any word beginning with “crypto” or any word ending with “alicious” or the complete phrase “green eggs and ham”.

If you want to block pages on any website that contain given keywords, you’ll need to use wildcards to specify all websites. For example:

*
~justin_bieber
~kim_kardashian

If you want pages with the specified keywords to be allowed rather than blocked, you should select the option Treat keywords as allow-conditions rather than block-conditions under Advanced Options. Thus, if you were to select that option with the example above, the effect would be to block all pages except those containing “justin bieber” or “kim kardashian” (not something I recommend, just for the record).

Note: LeechBlock looks for keywords only in the title or text of a webpage, not in the URL. If you want to block URLs containing keywords, you can do so like this:

somesite.com/**somekeyword
somesite.com/**anotherkeyword