Regular Expression Arabic characters and numbers only

后端 未结 11 986
梦毁少年i
梦毁少年i 2020-11-27 02:44

I want Regular Expression to accept only Arabic characters, Spaces and Numbers.

Numbers are not required to be in

11条回答
  •  死守一世寂寞
    2020-11-27 03:23

    You can use:

    ^[\u0621-\u064A\s\p{N}]+$
    

    \p{N} will match any unicode numeric digit.

    To match only ASCII digit use:

    ^[\u0621-\u064A\s0-9]+$
    

    EDIT: Better to use this regex:

    ^[\p{Arabic}\s\p{N}]+$
    

    RegEx Demo

提交回复
热议问题