PHP Regex - Finding multiple word start with # like '#ball' -
this question has answer here:
- retrieve hashtags tweet in php function 6 answers
i trying create php regex match if word start '#' '#ball'. have tried
preg_match_all('/( #\w+)/u', $text, $matches);
but returns words containing '#' 'pin#ball'.
try this:
$sdata = '#pin all#foo #bar'; preg_match_all('/(^|\s+)#([a-za-z]+)/', $sdata , $rgmatches); //var_dump($rgmatches[2]);
Comments
Post a Comment