Test, validate and match regular expressions
This regex matches Twitter-style hashtags by requiring a literal # symbol preceded by either the start of the string (\A) or a whitespace character (\s), followed by one or more word characters (\w+). The first group anchors the hashtag so it isn't matched mid-word (e.g., inside URLs like example.com#anchor), while the second capture group extracts the hashtag text itself. Used with the global flag, it finds all hashtags in a tweet or social media post, making it ideal for hashtag extraction, trending topic analysis, and social media text processing.