阿拉伯语的正则表达式 [英] Regular Expression For Arabic Language

查看:1593
本文介绍了阿拉伯语的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个匹配句子中每个单词的正则表达式:

I want to write a regular expression that matches each word in a sentence:

我的正则表达式: \ b(\ w +)\ b

结果:

虽然它适用于英语单词。使用阿拉伯语单词时不起作用。
我怎么能用阿拉伯语单词完成相同的专长?

While it works well with English Words. It does not work when using Arabic words. How could I accomplish the same feat for Arabic words?

推荐答案

试试这个: -

function HasArabicCharacters(text)
{
    var arregex = /[\u0600-\u06FF]/;
    alert(arregex.test(text));
} 

列表的阿拉伯字符集

[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufc3f]|[\ufe70-\ufefc]



Unicode中的阿拉伯语脚本:



Unicode 6.1 开始,阿拉伯语脚本包含在以下块中:

Arabic script in Unicode:

As of Unicode 6.1, the Arabic script is contained in the following blocks:

Arabic (0600—06FF, 225 characters)
Arabic Supplement (0750—077F, 48 characters)
Arabic Extended-A (08A0—08FF, 39 characters)
Arabic Presentation Forms-A (FB50—FDFF, 608 characters)
Arabic Presentation Forms-B (FE70—FEFF, 140 characters)
Rumi Numeral Symbols (10E60—10E7F, 31 characters)
Arabic Mathematical Alphabetic Symbols (1EE00—1EEFF, 143 characters)

内容来自维基百科 - Unicode中的阿拉伯语脚本

这篇关于阿拉伯语的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆