如何编写正则表达式以匹配阿拉伯语,英语,数字和间距字符?

Using regular expressions in PHP, how can I make the user input Arabic, English, digits, _, -, or a space.

For example, the user can input the following strings:

  • 10-abc
  • 10-من
  • 10-abcمن
  • _abcمن-10

To check for Arabic characters you can use

\p{InArabic}

This page might help you on your way.

Try this:

'/^([a-zA-Z0-9]|[\p{Arabic}]|[_])*$/u'