Last active
April 2, 2016 18:28
-
-
Save shaselton/aeb5ea3805519c973068ac7751500b45 to your computer and use it in GitHub Desktop.
You start working for a fancy new startup hoping to revolutionize social networking! GASP! They had this great idea that users should be able to specify relevant keywords to their posts using an ingenious idea by prefixing those keywords with the pound sign (#). Your job is to extract those keywords so that they can be used later on for whatever…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_hash_tags(str) | |
str.split(' ').select{ |word| /^#+([a-zA-Z])/.match(word) }.map{ |hash_tag| hash_tag.gsub(/^#+/, '') } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment