diff --git a/lib/linkify/parser.ex b/lib/linkify/parser.ex index 233c681..af5afef 100644 --- a/lib/linkify/parser.ex +++ b/lib/linkify/parser.ex @@ -15,7 +15,7 @@ defmodule Linkify.Parser do @get_scheme_host ~r{^\W*(?https?:\/\/)?(?:[^@\n]+\\w@)?(?[^:#~\/\n?]+)}u - @match_hashtag ~r/^(?\#[[:word:]_]*[[:alpha:]_·][[:word:]_·\p{M}]*)/u + @match_hashtag ~r/^(?\#[[:word:]_]*[[:alpha:]_·\x{200c}][[:word:]_·\p{M}\x{200c}]*)/u @match_skipped_tag ~r/^(?(a|code|pre)).*>*/ diff --git a/test/linkify_test.exs b/test/linkify_test.exs index 1abca5f..8a9ace4 100644 --- a/test/linkify_test.exs +++ b/test/linkify_test.exs @@ -555,6 +555,18 @@ defmodule LinkifyTest do hashtag_prefix: "https://example.com/tag/" ) == expected end + + test "ZWNJ does not break up hashtags" do + text = "#ساٴين‌س" + + expected = "#ساٴين‌س" + + assert Linkify.link(text, + rel: false, + hashtag: true, + hashtag_prefix: "https://example.com/tag/" + ) == expected + end end describe "links" do