我在 php 中有这个 English 和 Arabic regex
,它在 php 上运行良好
但它不适用于此库 Formvalidation.io
~^[a-z0-9٠-٩\-+,()/'\s\p{Arabic}]{1,}$~iu
I need to make it work and convert into JS regex to use in formvalidation regex.
最佳答案
[\u0600-\u06FF]
实际上,٠-٩
是这个阿拉伯语范围的子集,所以我认为您可以将它们从模式中删除。
因此,在 JS 中它将是
/^[a-z0-9+,()\/'\s\u0600-\u06FF-]+$/i
参见 regex demo
关于javascript - 如何将 PHP 正则表达式转换为将阿拉伯字符匹配到 JS 正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35036946/