Regular Expression Arabic characters and numbers only

后端 未结 11 1021
梦毁少年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:07

    In PHP, use this:

    preg_replace("/\p{Arabic}/u", 'x', 'abc123ابت');// will replace arabic letters with "x".
    

    Note: For \p{Arabic} to match arabic letters, you need to pass u modifier (for unicode) at the end.

提交回复
热议问题