Greasemonkey Reddit Filter

Daniel - Mar 14, 2008 - Tech Code

I've been learning a bit of JavaScript - and this is one of the things I've come up with, so far. Reddit Filter is fairly simple; it allows you to filter out submissions from certain URLs using a regular expression. Want to give it a shot? Follow these brief instructions:

  1. Install GreaseMonkey - this is a neat little Firefox addon, which allows you to customise the way a webpage is displayed, using JavaScript. There even appears to be a version that works in IE.

  2. Restart Firefox, then click on this link. You'll get a GreaseMonkey popup, and from there you can install the script.

  3. You'll need to put your own regular expression into the config section of the script, to match URLs on reddit - to do this, you need to right click on the GreaseMonkey icon on the right hand side of your Firefox status bar, select 'Manage Use Scripts', select 'Reddit Filter' and hit 'Edit'.

  4. The regular expression should match URLs in the form '' - essentially the script uses this string for each Reddit submission and matches it against your regex:

    Reddit Domain

  5. If you're not already familiar with regular expressions, take a look at this guide. The two most important things you need to know is that | is the 'or' operator, and you'll have to escape any special characters you want to include as literals. Special characters include + * . { } [ ] / ?

Here are some examples of regexes you can use to filter certain submissions:

  • - Self referencing posts
  •| - The lovely websites of xkcd and Barack Obama
  • .* - All addresses

Anyway - if anyone wants to use this source code, or improve it, please feel free! As I mentioned, I am new to JavaScript - it works perfectly for me, but if anyone has issues with it I'll be happy to hear. Enjoy.


so, uhm, added the script clicked 'manage user scripts', chose the reddit filter and clicked edit... i get a file open dialog... wtf do I do with that? why not just a text box where i put in the regexes?