Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need regular expression for multilingual which allow only alphabets

I need regular expression which allow only alphabets of any language but doesn't allow special characters and numbers. Right now i am using this express but it doesn't work in Arabic language

 ^(?=.{1,})[a-zA-Z'.\s]{1,50}$
like image 290
BASEER HAIDER JAFRI Avatar asked Jan 27 '26 05:01

BASEER HAIDER JAFRI


1 Answers

I need regular expression which allow only alphabets of any language but doesn't allow special characters and numbers.

You can use \p{L} which matches any kind of letter from any language.

^[\p{L}\s]{1,50}$

If you need to match ' and dot . as well, just add them to the character class.

^[\p{L}\s'.]{1,50}$
like image 73
hwnd Avatar answered Jan 29 '26 19:01

hwnd