In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "some regular expressions commonly used in JavaScript". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "some regular expressions commonly used in JavaScript".
Regular expression (regular expression) describes a pattern of string matching, which can be used to check whether a string contains a certain substring, replace a matching substring, or extract a substring from a string that meets a certain condition.
Var validateRegExp = {decmal: "^ ([+ -]?)\\ d *\.\\ d * $", / / floating point number decmal1: "^ [1-9]\\ dbath.\\ d * | 0.\\ d * [1-9]\\ d * $", / / positive floating point decmal2: "^-([1-9]\\ dbath.\\ d * | 0.\\ d * [1-9]\\ d *) $" / / negative floating point decmal3: "^ -? ([1-9]\\ dnumbers.\\ d * | 0.\ d * [1-9]\\ d * | 0% .0 + | 0) $", / / floating point decmal4: "^ [1-9]\\ dnumbers.\\ d * | 0.\ d * [1-9]\\ d * | 0% .0 + | 0 $" / / non-negative floating point number (positive floating point number + 0) decmal5: "^ (- ([1-9]\\ dnumbers.\\ d * | 0.\ d * [1-9]\\ d *)) | 0float .0 + | 0 $", / / non-positive floating point number (negative floating point number + / / 0) intege: "^ -? [1-9]\\ Dao $", / / Integer intege1: "^ [1-9]\\ Dao $" / / positive integer intege2: "^-[1-9]\\ dvalve $", / / negative integer num: "^ ([+ -]?)\\ d *\.?\\ d * $", / / numeric num1: "^ [1-9]\\ d * | 0 $", / positive number (positive integer + 0) num2: "^-[1-9]\\ d * | 0 $" / / negative number (negative integer + 0) ascii: "^ [\\ X00 -\\ xFF] + $", / / only ACSII character chinese: "^ [\\ u4e00 -\ u9fa5] + $", / / only Chinese color: "^ [a-fA-F0-9] {6} $", / / Color date: "^\\ d {4} (\\-|\\ / |\.)\ d {1m 2}\\ 1\ d {1m 2} $" / / date email: "^\\ w+ ((-\\ w+) | (\\.\\ w+)) *\ @ [A-Za-z0-9] + ((\\. | -) [A-Za-z0-9] +) *. [A-Za-z0-9] + $", / / email idcard: "^ [1-9] ([0-9] {14} | [0-9] {17}) $" / / ID card ip4: "^ (25 [0-5] | 2 [0-4]\\ d | [0-1]\\ d {2} | [1-9]?\\ d)\\. (25 [0-5] | 2 [0-4]\\ d | [0-1]\\ d {2} | [1-9]?\\ d)\. (25 [0-5] | 2 [0-4]\\ d | [0-1]\ d {2} | | [1-9]?\\ d)\\. (25 [0-5] | 2 [0-4]\\ d | [0-1]\ d {2} | [1-9]?\\ d) $" / / ip address letter: "^ [A-Za-z] + $", / / letter letter_l: "^ [Amurz] + $", / / lowercase letter_u: "^ [Amurz] + $", / / uppercase mobile: "^ 0? (13 | 15 | 18 | 14 | 17) [0-9] {9} $", / / Mobile notempty: "^\\ $" / / non-empty password: "^. * [A-Za-z0-9\\ walled -] +. * $", / / password fullNumber: "^ [0-9] + $", / / numeric picture: "(. *)\. (jpg | bmp | gif | pcx | jpeg | tif | png | raw | tga) $", / / Picture qq: ^ [1-9] * [1-9] [0-9] * $", / / QQ number rar:" (. *)\. (rar | zip | 7zip | tgz) $" / / compressed file tel: "^ [0-9\-()] {7jue 18} $", / / function of the phone number (including verifying domestic area code, international area code, extension) url: "^ http [s]?:\ /\ / ([\\ w -] +\\.) + [\\ w -] + ([\\ w. / / urlusername: "^ [A-Za-z0-9 _\\ -\ u4e00 -\\ u9fa5] + $", / / account name deptname: "^ [A-Za-z0-9 _ () ()\\ u4e00 -\\ u9fa5] + $", / / Unit name zipcode: "^\\ d {6} $", / / Postal Code realname: "^ [A-Za-z\ u4e00 -\ u9fa5] + $" / / Real name companyname: "^ [A-Za-z0-9 _ () ()\\ u4e00 -\\ u9fa5] + $", companyaddr: "^ [A-Za-z0-9 _ () ()\\ #\ -\ u4e00 -\\ u9fa5] + $", companysite: "^ http [s]?:\\ /\\ / ([\\ w-] +\ w -] + [\\ w -] + ([\\ wfect. / / Verification rule var validateRules = {isNull: function (str) {return (str = "| | typeof str! =" string ");}, betweenLength: function (str, _ min, _ max) {return (str.length > = _ min & & str.length 0) {/ / pin = strTrim (pin); / / if (pin = = str) {/ / return true;//} / /} return pwdLevel (str) = 1;}, weakPwd: function (str) {for (var I = 0; I)
< weakPwdArray.length; i++) {if (weakPwdArray[i] == str) {return true;}}return false;}};//休眠function sleep(numberMillis) {var now = new Date();var exitTime = now.getTime() + numberMillis;while (true) {now = new Date();if (now.getTime() >ExitTime) return;}} Thank you for reading, these are the contents of "some regular expressions commonly used in JavaScript". After the study of this article, I believe you have a deeper understanding of some regular expressions commonly used in JavaScript, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.