Not being an Arabist, I have no idea whether the output from the
following is correct or not, but I thought that it would be fun to run
Bruno's code on some 'real' Arabic rather than just on ^^^^ sequences —
% !TeX Program = Ini-XeTeX
\let \dump = \relax
\input xelatex.ini
\begingroup
\language = 8 % how to do this better?
\catcode "200D = 11
\lccode "200D = "200D
\patterns
{
^^^^06431^^^^0643
^^^^200d1^^^^200d
}
\endgroup
\documentclass {article}
\usepackage {polyglossia, fontspec}
\setdefaultlanguage {arabic}
\newfontfamily {\arabicfont} [Script=Arabic, Scale=1.2] {Amiri-Regular}
\textwidth = 1sp
\begin {document}
\catcode "200D = 11 %JOINER
\lccode "200D = "200D
\lefthyphenmin = 1
\righthyphenmin = 1
\language = 8
\arabicfont
ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d
ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d
ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d
ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d
ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d
ساڵیﻧﻮێتﭘﻴرۆزبێت^^^^200d^^^^200d ساڵیﻧﻮێتﭘﻴرۆزبێت
\end {document}