class Hashtag < ActiveRecord::Base
  
  has_many :hashtaggings
  has_many :hashtaggable, :through => :hashtaggings

  validates :name, uniqueness: true
  
  before_validation do
    self.slug = self.name.to_slug 
  end
  
  REGEX = /(?:\s|^)(?:#(?!(?:\d+|\p{Alpha}+?_|_\p{Alpha}+?)(?:\s|$)))(\p{Alpha}+)(?=\s|$)/i
end
