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?
You can create a character class which will match arabic language only:
/^[\p{Arabic}]*/
Here is the full reference
Arabic characters are :
'\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With