2

我有这个正则表达式

'/^[-a-zàáâãäåæçèéêëìíîïðñòóôõöøùúûüý€0-9\s*\.\'\/",_()|& ]*$/i'

它不接受阿拉伯字符。我怎样才能做到这一点?

或者我该如何编辑它以不接受* & ^ % $所有非字母英语和阿拉伯语字符?

http://code.google.com/p/validformbuilder/中的这个正则表达式

4

2 回答 2

0

You should check if it works for all your test cases, but as far as I can tell, the Arabic script is found in Unicode code points 0x0621 through 0x06FF, 0xFB50 through 0xFDFB, and 0xFE70 through 0xFEFC, so if you don't want to use XRegExp, you can try (JavaScript)

var myregexp = /^[\wàáâãäåæçèéêëìíîïðñòóôõöøùúûüý€\s*.'\/",()|& \u0621-\u06FF\uFB50-\uFDFB\uFE70-\uFEFC-]*$/i;

or (PHP)

regex = '%^[\wàáâãäåæçèéêëìíîïðñòóôõöøùúûüý€\s*.\'/",()|& \x{0621}-\x{06FF}\x{FB50}-\x{FDFB}\x{FE70}-\x{FEFC}-]*$%iu'
于 2012-11-05T10:51:14.890 回答
0

将 XRegExp 与 Unicode Base Addon 一起使用:

http://xregexp.com/plugins/

于 2012-11-05T10:45:42.447 回答