What is the validation expression to allow english and arabic and spaces in a textbox

246 Views Asked by At

I need to validate English / Arabic letters only with spaces in a textbox. I used below validation expressions, it accepts English / Arabic text, But it did not accept any spaces. Can anyone give me the right expression.

^[\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z]+[\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z-_]*$
1

There are 1 best solutions below

1
On

It is called a Regular Expression. To allow whitespaces, you need to add a whitespace to the set.

^[\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z-_ ]+$

This Regular Expression accepts English, Arabic letters and whitespaces. It also accetps only whitespace with no letters.