regex-util
github 地址: 傳送門
正則表達式可以用于匹配和替換,該項目搜集開發(fā)者日常開發(fā)任務(wù)需要用到的一些匹配、驗證的需求。
該項目會不斷收集,不斷優(yōu)化,歡迎issues!
安裝
$ npm install regex-util --save
使用
const regex-util = require('regex-util');
regex-util.isIDCard('440682199011133238')
API
Checker
-
isIDCard 身份證檢查
/** * Check whether the content is IDCard * @param {string} content */ isIDCard = function( content ) -
isPassword 檢查是否符合密碼強度 (密碼的強度必須是包含大小寫字母和數(shù)字的組合,不能使用特殊字符,長度在8-10之間) ,
參數(shù)可以調(diào)整/** Check whether the password meets the requirements
@param {string} content
@param {boolean} isGroup 是否開啟包含大小寫字母和數(shù)字的組合
@param {boolean} acceptSpecial 能否使用特殊字符
@param {int} starLength 最低長度
-
@param {int} endLength 最高長度
*/
isPassword = function( content , isGroup , acceptSpecial , starLength , endLength) -
isChinese 中文檢查
/** * Check whether the content is Chinese * @param {string} content */ isChinese = function( content ) isEmail 郵箱檢查
/**
* Check whether the content is Email
* @param {string} content
*/
isEmail = function( content )
```
* isMoney 金額檢查
/**
- 檢查文本是否是金額,支持小數(shù)點
- @param {string} content
*/
isMoney = function( content )
```
- isPhone 手機號檢查
/**
* Check whether the content is Phone
* @param {string} content
*/
isPhone = function( content )
```
###Matcher
* getPictures 獲取html中的所有圖片鏈接
/**
- @param {string} html
*/
getPictures = function( html )
```
License
MIT