tags:

views:

91

answers:

2
+2  Q: 

Help in PHP Regx

Using PHP Regx, I need to make the user input arabic,english,digits and the following characters(_ and - and space)

user can input string as the following:

10-abc 10-من 10-abcمن _abcمن-10

and so on.

Advice me please.

A: 

the right expression for english, digits and _ and - is ... [a-zA-Z0-9_-]* (the little trailing minus makes me a little nervous, but it seems to work) ... now you will have to put arabic charaters in there as well (hopefully, this works as a character range, as with english) ... can't help you on that, since i don't know any arab ...

good luck ... ;)

back2dos
+4  A: 

To check for Arabic characters you can use

\p{InArabic}

This page might help you on your way.

Chalkey
/p{InArabic}=>"unknown property name after \P or \p" but /p{Arabic} works. Test version php 5.3, PCRE Library Version => 7.9 2009-04-11
VolkerK