Extracting hash tags from string


I am playing around with the Twitter API and I am trying to extract
the hash tags from the updates. Something like this:

“This is the string that I want to pull #tags #out #of

I have the regex that gets the tags, but I am not sure how to extract
them from the string into an array.

Thanks in advance!

Pass the regex to String#scan, which will return an array of matches.
the docs for details.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs