我想知道以下内容的等价物,但仅限阿拉伯字母:
$regex = '[A-Za-z0-9-[\]_+ ]+'
我试过了:
$regex = '[ا-ئ0-9 ]+';
其中第一个阿拉伯字母ا
和最后一个ئ
。但是,我收到以下错误:
[phpBB Debug] PHP Warning:
in file [ROOT]/includes/functions_user.php on line 1505: preg_match():
Compilation failed: range out of order in character class at offset 6
最佳答案
您可以检查您的 Regex 风格是否支持 \p{Arabic}
或 \p{InArabic}
尝试:
$regex = '[\p{Arabic}\d-\[\]_+ ]+'
关于php - 仅带空格的阿拉伯字母数字正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23163490/