Skip to content

Instantly share code, notes, and snippets.

Last active December 13, 2015 14:36
Show Gist options
  • Save ndarville/d817acd80c80e9d8cea6 to your computer and use it in GitHub Desktop.
Save ndarville/d817acd80c80e9d8cea6 to your computer and use it in GitHub Desktop.
Star Wars: The Force Awakens spoiler filter

Star Wars: The Force Awakens Filter

This is a basic regular expression (pattern-matching script) to detect, and ideally filter, all things Star Wars, be it to avoid spoilers, or just everything Star Wars.

To see the filter in action, go to this demo. To read more about the filter and get the Tweetbot mute filter, go to the blog post.

The word list contains a list of some characters and actors. Depending on your degree of blackout, you may consider some of them spoilers. I personally do not, but I can set up a separate page with just the Tweetbot link to protect your innocence.


MIT seems like the most permissive, so let’s use that one for now.

Word List

  • Maz Kanata
  • Han Solo, Harrison Ford+
  • Leia, Carrie Fisher+
  • Skywalker, Hamill+
  • Chewbacca, Chewie, Wookie(e), Mayhew+
  • Kylo, Adam Driver+
  • Daisy Ridley+
  • Boyega+
  • Abrams+, JJA+, J.J.A.+, J. J. A.+
  • (General) Hux, Domhnall+, Gleeson+
  • (Captain) Phasma, Gwendoline (Christie)+
  • Vader, Darth - sorry, @darth
  • Snoke
  • R2-D2
  • C3PO
  • Lor San, Tekka, (Max von) Sydow+
  • BB-8
  • (Poe) Dameron, Oscar Isaac+

  • Star Wars, Force Awakens
  • Lightsaber
  • Jedi
  • Stormtrooper
  • Millennium Falcon

+ Refers to a filter based on the actor/director’s real name. You may not want to include this, if you want to follow the person—while risking the spoiler. You may have wondered why Lupita Nyong’o is not on the list. Go figure.

(?i)\b(Maz( )?Kana(a)?ta|Han( )?Solo|Har(r)?ison( )?Ford|Leia|Carrie( )?Fisher|Skywalker|Hamill|Chewbacca|Chewie|Wookie|Mayhew|Kylo|Adam( )?Driver|Daisy( )?Ridley|Boyega|Abrams|J(\.)?( )?J(\.)?( )?(A)?(\.)?( )?|Hux|Domhnall|Gleeson|Phasma|Gwendoline|Vader|Darth|Snoke|R2(\-)?D2|C3PO|Lor( )?San|Tekka|Sydow|BB(\-)?8|Dameron|Oscar( )?Isa(a)?c|Star( )?War(s)?|Force( )?Awakens|Light( )?saber|Jedi|Storm( )?trooper|Millennium( )?Falcon)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment