Hashtag Regex
Matches hashtags used in social media posts.
パターン
/#([A-Za-z0-9_]+)/g
→ ビジュアライザーで開くテスト例
Loving #webdev and #JavaScript! Follow #coding #opensource
コード例
javascript
const regex = /#([A-Za-z0-9_]+)/g; const result = [...str.matchAll(regex)].map(m => m[1]);
python
import re pattern = re.compile(r'#([A-Za-z0-9_]+)') result = pattern.findall(text)
go
import "regexp" re := regexp.MustCompile(`#([A-Za-z0-9_]+)`) result := re.FindAllString(text, -1)
socialhashtagparsing