fork download
  1. content_received = 'pepe is watching a @comedy :)'
  2. categories = ['Comedy :)', 'terror']
  3.  
  4. prep_content_received = content_received.gsub(/[^\w\s]|_/,'')
  5. p categories.select { |c|
  6. prep_content_received.match?(/\b#{c.gsub(/[^\w\s]|_/, '').strip()}\b/i)
  7. }
  8.  
Success #stdin #stdout 0.01s 6320KB
stdin
Standard input is empty
stdout
["Comedy :)"]