How to combine Arabic words with reg exp?

I have a line like this: "سلام علیکم", which is a two-word Arabic phrase. I want to combine the first word with a regular expression. If it were English, I would check /^[a-zA-Z]*/ . how can i do this with arabic?

+6
source share
2 answers

You can create a character class that matches only the Arabic language:

 /^[\p{Arabic}]*/ 

Here is the full link

+5
source

Arabic characters:

 '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC' 
+4
source