Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个字符串,我想检查该字符串是否有数字,该字符串可以包含带有国家代码的字母或手机号码。所以我想检测它是否有手机号码(可以有+或'0'和整数)。
我尝试使用这个 [0-9] 但它无法为它制作模式。
谢谢
该字符串是否来自表单输入?如果是这样,有一个名为Masked Input的 jQuery 库。
如果它来自您想要在内部验证的集合变量,您需要查看此处。
希望这可以帮助。
得到了解决方案
\b[0-9+]+\b
在这里测试
http://www.regular-expressions.info/javascriptexample.html