0

I am using the below plugin to fetch tweets and display them.

http://tweet.seaofclouds.com/

Within the plugin is a filter feature, and the below regex filters out all tweets on the account which are replies:

filter: function(t){ return ! /^@\w+/.test(t.tweet_raw_text); }

I wish to now build on this filter to only display tweets which contain the hashtag '#capetowntrains'

Can anyone assist me with the correctly formed RegEx statement?

Thanks for the help

Regards

Devin

1 Answer 1

2

Should just need to change it to this

filter: function(t){ 
    return (! /^@\w+/.test(t.tweet_raw_text)) && (/#capetowntrains/.test(t.tweet_raw_text)); 
}

We only keep things that are not replies and also contain #capetowntrains.

EDIT: and if you want it to be case insensitive (note the added i)

filter: function(t){ 
    return (! /^@\w+/.test(t.tweet_raw_text)) && (/#capetowntrains/i.test(t.tweet_raw_text)); 
}
Sign up to request clarification or add additional context in comments.

2 Comments

Hi CaffGeek. Thanks for your response. I need the regex to still remove the replies in addition to filtering out the hashtag. Can you please combine the 2.
@user1434739, Sorry, that wasn't clear in the question. Fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.