Hashtag (#) Regular Expression

A regular expression to match hashtags (#) used in social media platforms.

/^#[^ !@#$%^&*(),.?":{}|<>]*$/

Matches:

  • #google
  • #regex_pattern
  • #regex-pattern

Non-matches:

  • @regex/pattern
  • regexpattern
  • regexpattern#

See Also: