Skip to content

Instantly share code, notes, and snippets.

@wofockham
Last active May 10, 2022 01:44

Hashtag Extractor

Write a function that takes a string and returns an array of any hashtags it contains:

get_tags("Nothing is true. Everything is deprecated. #yolo #deprecated #bloating")

# => ['#yolo', '#deprecated', '#bloating']

Mention Extractor

Write a function that takes a string and returns an array of any @mentions it contains:

get_mentions("@sydneyga Some @jerk won't hire women because they get pregnant #rorosyd #smdh #misandry")

# => ['@sydneyga', '@jerk']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment