diff --git a/lib/auto_linker/parser.ex b/lib/auto_linker/parser.ex
index 74d50ee..435ba83 100644
--- a/lib/auto_linker/parser.ex
+++ b/lib/auto_linker/parser.ex
@@ -25,7 +25,6 @@ defmodule AutoLinker.Parser do
~s{, work (555) 555-5555}
"""
- # @invalid_url ~r/\.\.+/
@invalid_url ~r/(\.\.+)|(^(\d+\.){1,2}\d+$)/
@match_url ~r{^[\w\.-]+(?:\.[\w\.-]+)+[\w\-\._~%:/?#[\]@!\$&'\(\)\*\+,;=.]+$}
@@ -45,7 +44,7 @@ defmodule AutoLinker.Parser do
# https://www.w3.org/TR/html5/forms.html#valid-e-mail-address
@match_email ~r/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/u
- @match_hashtag ~r/^(?\#\w+)/u
+ @match_hashtag ~r/^(?\#[[:word:]_]*[[:alpha:]_ยท][[:word:]_]*)/u
@prefix_extra [
"magnet:?",
@@ -362,11 +361,8 @@ defmodule AutoLinker.Parser do
def match_hashtag(buffer) do
case Regex.run(@match_hashtag, buffer, capture: [:tag]) do
- [hashtag] ->
- if Regex.match?(~r/#\d+$/, hashtag), do: nil, else: hashtag
-
- _ ->
- nil
+ [hashtag] -> hashtag
+ _ -> nil
end
end