I can not find a regular expression that matches any hashtag #, @or word boundary. The goal is to break the string into objects and topics like Twitter, in this way:
input = "Hello @world, #ruby anotherString"
input.scan(entitiesRegex)
# => ["Hello", "@world", "#ruby", "anotherString"]
To get only words, ex "anotherString", which is too big, is simple:
/\b\w{3,12}\b/
will return ["Hello", "world", "ruby"]. Unfortunately, this does not include hashtags and @s. It seems to work just with:
/[\b@
but returns ["@world", "#ruby"]. This made me realize that word boundaries are by definition not a symbol, so they don’t fall into the category of “One character” and therefore do not match. A few more attempts:
/\b|[@
returns ["", "", "@world", "", "#ruby", "", "", ""].
/((\b|[@
, [[""], ["@"], ["#"], [""]], , .
/((\b|[@
. [["Hello", ""], ["@world", "@"], ["#ruby", "#"]]. , , . :
input.scan(/((\b|[@#])\w{3,12}\b)/).collect(&:first)
, collect?