Forum: Ruby on Rails Extracting hash tags from string

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7f6b1bbe2d0b278f701c3f785925a6c2?d=identicon&s=25 Matthew Crist (soxfan)
on 2009-01-13 10:29
(Received via mailing list)
Hello,

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!
B14575f0ca69f10938fdd67e7156e0e1?d=identicon&s=25 Craig Demyanovich (Guest)
on 2009-01-13 15:49
(Received via mailing list)
Pass the regex to String#scan, which will return an array of matches.
Check
the docs for details.

Regards,
Craig
This topic is locked and can not be replied to.