In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use regular expressions to find letters and numbers in js, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!
The specific code is as follows:
_ window.onload=function () {localStorage.fiveData= "Hello to the world"; / / alert (localStorage.fiveData); / / var reg=/\ dAccordash / match any length digit var reg=/ [a Lizi Z] / g reg / match any letter var str= "aajdaf1232jadlfjakdjfalkjlakfj2131l34kalfsjaafaqejqe231wk"; var t=str.match (reg); for (var c in t) {console.log (t [c]);}}
Let's take a look at how JS uses regular expressions to verify that passwords contain numbers and letters.
Must contain at least one digit and one letter, scripted as follows:
The function CheckPassWord (password) {/ / password must contain numbers and the letters var str = password; if (str = = null | | str.length < 8) {return false;} var reg = new RegExp (/ ^ (?! [^ a-zA-Z] + $) (?!\ zA-Z $) /); if (reg.test (str)) return true;}
Must contain numbers plus letters and cannot contain special symbols, etc. The script method is as follows:
Function CheckPassWord (password) {/ / must be alphanumeric and have a length of not less than 8 digits var str = password; if (str = = null | | str.length
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.