UNPKG

js-wrench

Version:

JS函数库

2,576 lines (669 loc) 27.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: CheckRegExp</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: CheckRegExp</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>CheckRegExp<span class="signature">()</span><span class="type-signature"></span></h2> </header> <article> <div class="container-overview"> <h4 class="name" id="CheckRegExp"><span class="type-signature"></span>new CheckRegExp<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> 正则验证 使用单例 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line1">line 1</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".getInstance"><span class="type-signature">(static) </span>getInstance<span class="signature">()</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 获取实例 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line15">line 15</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="cn"><span class="type-signature"></span>cn<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配中文 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line149">line 149</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>cn("中文") => true cn("cn") => false</code></pre> <h4 class="name" id="email"><span class="type-signature"></span>email<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配邮箱地址 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line173">line 173</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>email("1324568@qq.com") => true</code></pre> <h4 class="name" id="en"><span class="type-signature"></span>en<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配英文 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line137">line 137</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>en("cn") => true</code></pre> <h4 class="name" id="html"><span class="type-signature"></span>html<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配HTML标签 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line161">line 161</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>html("&lt;div>&lt;/div>") => true</code></pre> <h4 class="name" id="IDcard"><span class="type-signature"></span>IDcard<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配身份证号码 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line77">line 77</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>IDcard("2313213213") => false</code></pre> <h4 class="name" id="IPv4"><span class="type-signature"></span>IPv4<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配IP </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line113">line 113</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>IPv4("127.0.0.1") => true</code></pre> <h4 class="name" id="mobile"><span class="type-signature"></span>mobile<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配手机号码 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line29">line 29</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>mobile(12345678) => return false</code></pre> <h4 class="name" id="number"><span class="type-signature"></span>number<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配数字 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line125">line 125</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>number("123") => true number("s1") => false</code></pre> <h4 class="name" id="password"><span class="type-signature"></span>password<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配密码 密码以字母开头,长度在6~18之间,只能包含字母、数字和下划线 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line53">line 53</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>password("abc!@") => false</code></pre> <h4 class="name" id="postal"><span class="type-signature"></span>postal<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配邮政编码 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line89">line 89</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>postal("511740") => true</code></pre> <h4 class="name" id="qq"><span class="type-signature"></span>qq<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配QQ号码 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line65">line 65</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>qq("12345") => false</code></pre> <h4 class="name" id="telephone"><span class="type-signature"></span>telephone<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配座机 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line41">line 41</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>telephone("1367894517") => false</code></pre> <h4 class="name" id="url"><span class="type-signature"></span>url<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配URL </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line101">line 101</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>url("http://127.0.0.1") => true url("http://www.abc.com") => true</code></pre> <h4 class="name" id="username"><span class="type-signature"></span>username<span class="signature">(v)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 匹配账号合法 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">要匹配的内容</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="check.js.html">check.js</a>, <a href="check.js.html#line185">line 185</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {boolean} 返回一个布尔值 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>username(abc_132) => true</code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="CheckRegExp.html">CheckRegExp</a></li><li><a href="Format.html">Format</a></li></ul><h3>Global</h3><ul><li><a href="global.html#bind">bind</a></li><li><a href="global.html#debounce">debounce</a></li><li><a href="global.html#deepCopy">deepCopy</a></li><li><a href="global.html#each">each</a></li><li><a href="global.html#empty">empty</a></li><li><a href="global.html#extend">extend</a></li><li><a href="global.html#getBrowserType">getBrowserType</a></li><li><a href="global.html#getUID">getUID</a></li><li><a href="global.html#getVerifyCode">getVerifyCode</a></li><li><a href="global.html#has">has</a></li><li><a href="global.html#includes">includes</a></li><li><a href="global.html#indexOf">indexOf</a></li><li><a href="global.html#isAndroid">isAndroid</a></li><li><a href="global.html#isArray">isArray</a></li><li><a href="global.html#isBool">isBool</a></li><li><a href="global.html#isDate">isDate</a></li><li><a href="global.html#isFn">isFn</a></li><li><a href="global.html#isIOS">isIOS</a></li><li><a href="global.html#isiPad">isiPad</a></li><li><a href="global.html#isMap">isMap</a></li><li><a href="global.html#isNaN">isNaN</a></li><li><a href="global.html#isNull">isNull</a></li><li><a href="global.html#isNumber">isNumber</a></li><li><a href="global.html#isObj">isObj</a></li><li><a href="global.html#isPC">isPC</a></li><li><a href="global.html#isPrimitive">isPrimitive</a></li><li><a href="global.html#isPromise">isPromise</a></li><li><a href="global.html#isRegExp">isRegExp</a></li><li><a href="global.html#isSet">isSet</a></li><li><a href="global.html#isString">isString</a></li><li><a href="global.html#isSymbol">isSymbol</a></li><li><a href="global.html#isUndefined">isUndefined</a></li><li><a href="global.html#isWPhone">isWPhone</a></li><li><a href="global.html#ltrim">ltrim</a></li><li><a href="global.html#noop">noop</a></li><li><a href="global.html#random">random</a></li><li><a href="global.html#remove">remove</a></li><li><a href="global.html#reverse">reverse</a></li><li><a href="global.html#rtrim">rtrim</a></li><li><a href="global.html#throttle">throttle</a></li><li><a href="global.html#toFirstLower">toFirstLower</a></li><li><a href="global.html#toFirstUpper">toFirstUpper</a></li><li><a href="global.html#toKeys">toKeys</a></li><li><a href="global.html#toLowerCase">toLowerCase</a></li><li><a href="global.html#toParam">toParam</a></li><li><a href="global.html#toQuery">toQuery</a></li><li><a href="global.html#toUpperCase">toUpperCase</a></li><li><a href="global.html#toValues">toValues</a></li><li><a href="global.html#trim">trim</a></li><li><a href="global.html#typeOf">typeOf</a></li><li><a href="global.html#unique">unique</a></li><li><a href="global.html#uniqueToArray">uniqueToArray</a></li><li><a href="global.html#uniqueToNumber">uniqueToNumber</a></li><li><a href="global.html#uniqueToSizzArray">uniqueToSizzArray</a></li><li><a href="global.html#uniqueToSttring">uniqueToSttring</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Wed Dec 16 2020 10:48:43 GMT+0800 (GMT+08:00) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>