Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

Hashtag abuse

Three or more hashtags.

#[^#]+#[^#]+#

Long hashtags (15+ characters): #hashtagpunchline

#[^ ]{15}

CamelCase hashtags (3+ Words): #NotSelfAware

#[^a-z ]+[^A-Z ]+[^a-z ]+[^A-Z ]+[^a-z ]+[^ ]*

Painful to read

Unforgivable word shortening: I'm near ur place r u busy?

\sur\s
\sr\s
\su\s

Mass conversations (4+ Mentions): @guy @dude @otherguy @man totally.

@[^@]+@[^@]+@[^@]+@

Retweet chains (2+ RTs): OMG RT @teengirlsquad RT @beebz I'm thinking of you.

RT[^RT]+RT

Mentions with only a URL (spam): @imathis tinyurl.com/spam

^@imathis *https?://[^ ]+$
@azizZaben

This comment has been minimized.

Copy link

azizZaben commented Jul 1, 2012

I'm trying to mute ask.fm and sayat.me do you have any clue?

@imathis

This comment has been minimized.

Copy link
Owner Author

imathis commented Jul 1, 2012

@azizZaben unfortunately Twitter replaces urls with their t.co shortened versions. Apps replace them inline with the full urls from the API provided metadata but the regex only matches on the original tweet text. Perhaps you could ask TapBots support to run mute filters after text replacement. I'll ask them too.

@kameit00

This comment has been minimized.

Copy link

kameit00 commented Aug 29, 2012

With Tweetbot you can mute Clients. So it should be possible to mute ask.fm. For example: foursquare tweets have something like "foursquare" as the application used for writing the tweet. Does that make sense?

@kr

This comment has been minimized.

Copy link

kr commented Jan 9, 2013

Hello, I forked this gist and made the regexps easier to read. Some of my changes cause slightly different behavior, though, although some still match the exact same set of tweets.

@soundsgoodtome

This comment has been minimized.

Copy link

soundsgoodtome commented May 27, 2013

Thanks for these. However, there's still a format I can't find anywhere:

Say I follow @Superman, and he constantly talks about kryptonite. I don't want to mute all mentions of the word "kryptonite," just his mentions of it.

Would I simply mute:

@Superman+kryptonite

(?) Or is the syntax different? Thanks in advance.

@WillEccles

This comment has been minimized.

Copy link

WillEccles commented Jun 15, 2015

For the 3 hashtags one, I would have said (#[^# ]+[ ]*.*){3} 😄
Yours will not catch the 3rd hashtag completely, in a tweet such as "#magic is #cool and I also like the # sign." The third # is not a hashtag, but it still is counted as one.

@realrolfje

This comment has been minimized.

Copy link

realrolfje commented Nov 12, 2017

In recent developments, I would add:

Mute tweets longer than 140 characters: [^]{140}

See https://twitter.com/rolfje/status/929643146002255872

Apparently that does not work correctly, and .{140} means I loose all 140 char tweets with expanded links in them. I think this requires more work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.