- Catch hashtag exclude starting and ending with underscore
(?:\s|^)(?:#(?!(?:\d+|\w+?_|_\w+?)(?:\s|$)))(\w+)(?=\s|$)
- Catch hashtag include starting and ending with underscore
(?:\s|^)(?:#(?!\d+(?:\s|$)))(\w+)(?=\s|$)
- Catch repeating words (only catch 1 if duplicate)
(?!.*\b\1\b)
You can test regex at https://regex101.com/