+ // Otherwise pull out single word tags. These can be @nickname, @first_last
+ // and #hash tags.
+
+ if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
+ foreach($match[1] as $mtch) {
+ if(strstr($mtch,"]")) {
+ // we might be inside a bbcode color tag - leave it alone
+ continue;
+ }
+ // ignore strictly numeric tags like #1
+ if((strpos($mtch,'#') === 0) && ctype_digit(substr($mtch,1)))
+ continue;
+ if(substr($mtch,-1,1) === '.')
+ $ret[] = substr($mtch,0,-1);
+ else
+ $ret[] = $mtch;
+ }
+ }