php - 仅带空格的阿拉伯字母数字正则表达式

标签 php regex arabic phpbb3

我想知道以下内容的等价物,但仅限阿拉伯字母:

$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/

相关文章:

php - Apache 错误 [通知] Parent : child process exited with status 3221225477 -- Restarting

php - 使用 Codeigniter 在数据库中存储 HTML 标签(包括 PHP 脚本)

java - 正则表达式:匹配没有初始零且没有最后两个零的字符串

Java正则表达式。不包括定界符的组

php - 删除阿拉伯变音符号

安卓 : Connected and colored arabic letters

php - 在 Silverstripe 中扩展对象时如何修改或删除现有的 Summary_fields?

php - 改变随机句子的顺序

java - 从字符串中删除斜体和粗体 html 标签?

android - 在 web View 和 TextView 中使用 html 颜色标签分隔阿拉伯语字体