Created
June 11, 2012 16:04
-
-
Save hanigamal/2910853 to your computer and use it in GitHub Desktop.
Regex for the whole unicode range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$string = <<<EOF | |
<p dir="rtl"> | |
أَفَلاَ يَتَدَبَّرُونَ الْقُرْآنَ وَلَوْ كَانَ مِنْ عِندِ غَيْرِ اللّهِ لَوَجَدُواْ فِيهِ اخْتِلاَفًا كَثِيرًا | |
</p> | |
EOF; | |
preg_match('/<p dir=(?:"rtl"|\'rtl\')>([\x{0600}-\x{06FF}\x{0750}-\x{077F}\x{FB50}-\x{FDFF}\x{FE70}-\x{FEFF} \r\n]+)<\/p>/um', $string, $matches); | |
$match = $matches[1]; | |
echo $match; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
السلام عليكم ورحمة الله وبركاته
التالية هي للحروف فقط
([\x{0620}-\x{063A}\x{0641}-\x{064A}])
والتالية هنا خاصة بالتشكيل
([\x{064B}-\x{0652}])