Commonly used regex, npm package vue-canonical-encyclopedia, and how to use vue-canonical-encyclopedia in the actual development of Vue, React and other projects

foreword

insert image description here

In the daily development of our front-end, we always need various rules to judge our information. It is very troublesome to re-write every time, so the author has developed the npm package of regular rules, which will be continuously updated and updated. Open source and free.

npm package address

https://www.npmjs.com/package/vue-canonical-encyclopedia

install this project

npm i vue-canonical-encyclopedia

use this item

// 导入本项目
const R=require('vue-canonical-encyclopedia');

// 使用本项目 示例如下
//火车车次
const Train_number=R.Regular.Train_number;
console.log(Train_number);

all regular parameters

parameter Parameter Description
Train_number train number
IMEI Mobile phone body number (IMEI)
Url_port A URL (or ip) with a port number is required
Url web address (URL)
Social_credit Unified Social Credit Code
Social_credit2 Unified social credit code (loose matching) (15 digits/18 digits/20 digits/letters)
Thunderbolt_Link Thunder link
ed2k_Link ed2k link (loose match)
Magnet_URI Magnet link (loose match)
Subnet_mask Subnet mask (excluding 0.0.0.0)
Linux_hidden_path linux "hidden files" path
Linux_folder_path linux folder path
Linux_file_path linux file path
window_folder_path window "folder" path
window_file_path "File" path under window
Stock_code Stock code (A shares)
Test_score Greater than or equal to 0, less than or equal to 150, support 5 decimal places, such as 145.5, used to judge the test paper score
Html_comments html comments
md5_32 md5 format (32 bits)
GUID_UUID GUID/UUID
Version The format of the version number (version) must be XYZ
Video_url Video (video) link address (video format can be added or deleted as needed)
Image_url Image (image) link address (image format can be added or deleted as needed)
HH_mm_ss 24-hour format time (HH:mm:ss)
hh_mm_ss 12-hour time (hh:mm:ss)
base64 base64 format
Monetary_amount Numeric/currency amount (supports negative numbers, thousands separator)
Just_Monetary_amount Number/currency amount (only positive numbers are supported, and thousands separators are not supported for verification)
Card_No Bank card number (10 to 30 digits, covering public/private accounts)
Chinese_name Chinese name
English_name English name
License_plate_new License plate number (new energy)
License_plate_no License plate number (non-new energy)
License_plate_blend License plate number (new energy + non-new energy)
Mobile_number_China_strict Mobile phone number (mobile phone) China (strict), according to the latest mobile phone number range released by the Ministry of Industry and Information Technology in 2019
Mobile_number_China_easy Mobile phone number (mobile phone) China (loose), as long as it starts with 13, 14, 15, 16, 17, 18, 19
Mobile_number_China_Most_loose Mobile phone number (mobile phone) China (the most relaxed), as long as it starts with 1, if your mobile phone number is used to receive text messages, it is recommended to choose this one first
Date_easy date (loose)
Date_strict Date (rigorous, supports leap year judgment)
China_Province province of china
Time_format Time that can be successfully converted by moment YYYYMMDD HH:mm:ss
Email email (email)
Tel_phone_china Landline (tel phone) telephone (domestic), such as: 0341-86091234
ID_number1 ID number (1 generation, 15 digits)
ID_number2 ID number (2 generations, 18 digits), the last digit is a check digit, which may be a number or character X
ID_number1_2 ID number, support 1/2 generation (15 digits/18 digits)
Passport Passport (including Hong Kong and Macau)
Account_number Is the account legal (starts with a letter, allows 5-16 bytes, and allows a combination of letters, numbers and underscores)
Chinese 中文/汉字
Decimal 小数
Number 只包含数字
HTML_easy html标签(宽松匹配)
Chinese_punctuation 匹配中文汉字和中文标点
QQ_number qq号格式正确
Numeric_letters 数字和字母组成
English_letter 英文字母
Small_English_letters 小写英文字母组成
Capital_letters 大写英文字母
Password_strength_check 密码强度校验,最少6位,包括至少1个大写字母,1个小写字母,1个数字,1个特殊字符
User_name_verification 用户名校验,4到16位(字母,数字,下划线,减号)
Ipv4 ip-v4[:端口]
Ipv6 ip-v6[:端口]
Hexadecimal_color 16进制颜色
Wechat_number 微信号(wx),6至20位,以字母开头,字母,数字,减号,下划线
Postal_Code_China 邮政编码(中国)
Chinese_numeralsL 中文和数字
Cannot_contain_letters 不能包含字母
Java_package_name java包名
Mac_url mac地址
Continuous_repeating_characters 匹配连续重复的数字字符
Digital_English_Chinese 数字和英文字母组成,并且同时含有数字、中文和英文字母
HongKong_Identity_Card 香港身份证
Macau_Identity_Card 澳门身份证
Taiwan_ID_card 台湾身份证
Password_3 大写字母,小写字母,数字,特殊符号 @#$%^&*~()-+=` 中任意3项密码
ASCII_special ASCII码表中的全部的特殊字符
Positive_integer_0 正整数,不包含0
Negtive_integer_0 负整数,不包含0
Integer 整数
Floating_point_number 浮点数
Floating_point_number_strict float (strict)
Chinese_mailbox email (support Chinese email)
Domain_name Domain name (not a URL, does not include a protocol)

This article is original, and it is not easy to be original. If you need to reprint, please contact the author for authorization.

Guess you like

Origin blog.csdn.net/qq_36034945/article/details/128671061