Browse Source

Merge pull request #137 from Skehmatics/fix/apostrophe-bug

(Lazily) fix #131 by ignoring hashtags that begin with a ampersand in lexer
daniel 7 years ago
parent
commit
16f4d52476
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/Util/Lexer/Hashtag.php

+ 1 - 1
app/Util/Lexer/Hashtag.php

@@ -7,7 +7,7 @@ class Hashtag {
   public static function getHashtags($status)
   public static function getHashtags($status)
   {  
   {  
     $hashtags = false;  
     $hashtags = false;  
-    preg_match_all("/(#\w+)/u", $status, $matches);
+    preg_match_all("/(?<!&)(#\w+)/u", $status, $matches);
     if ($matches) {
     if ($matches) {
         $res = array_count_values($matches[0]);
         $res = array_count_values($matches[0]);
         $hashtags = array_keys($res);
         $hashtags = array_keys($res);