<?php
$subject = <<<EOF
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi dignissimos expedita impedit libero maiores quam reprehenderit temporibus veritatis! Illo nemo obcaecati sapiente vero? Dicta enim fugiat, ipsam nobis quae recusandae!
hello world
窝窝头一块钱四个
风轻云淡
嘿嘿
복제
الألوانالداكنةعلىحدةالغسيل2./البوليسثر/3./قطن/;4...المصدر5./اليافلدنة
Όλα τα διαμερίσματα, τριών αστέρων
EOF;
// 分别为 汉语 希腊语 阿拉伯语
$pattern = "/\p{Han}+|\p{Greek}+|\p{Arabic}+/u";
//$pattern = "/\p{Greek}+/u";
//$pattern = "/\p{Arabic}+/u";
preg_match_all($pattern, $subject, $match);
print_r($match);
支持多国语言正则匹配
匹配结果
然后放个PHP官方链接,后面再研究下
https://www.php.net/manual/zh/regexp.reference.unicode.php