Added verification for mobile phone numbers starting with 158 and 159.
//Remove the leading and trailing spaces of the string
String. prototype.Trim = function() {
var m = this.match(/^s*(S (s S )*)s*$/);
return (m == null) ? "" : m[1];
}
//Verify legal mobile phone number
String.prototype.isMobile = function() {
return (/^(?:13d|15[89])-? d{5}(d{3}|*{3})$/.test(this.Trim()));
}
should instance:
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn