6

I have a string like this: "سلام علیکم" which is a two word arabic phrase. I want to match first word with regular expression. If it was english I would test /^[a-zA-Z]*/. how can I do it with arabic?

RobyJas
  • 75
  • 5

2 Answers2

7

You can create a character class which will match arabic language only:

/^[\p{Arabic}]*/

Here is the full reference

VladL
  • 12,769
  • 10
  • 63
  • 83
4

Arabic characters are :

'\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC'
Mostafa Shahverdy
  • 2,687
  • 2
  • 30
  • 51