我需要一个正则表达式来匹配以 # 开头的单词。
我写了这个问题How to match a pound (#) symbol in a regex in php (for hashtags),但我忘了解释我需要在单词的开头使用 # 。
我需要匹配#word、 #123、 #12_sdas,但不是1#234或#1234。
例如,在 中"#match1 notMatch not#Match #match2 notMatch #match3"
,只有#match1、#match2和#match3应该出现。
编辑:我只想要一磅 (#),然后是一个或多个 [a-ZA-Z0-9_]。比赛之前不能有任何 [a-ZA-Z0-9_]。
我的问题是在单词的开头找到英镑。