Tag:js

  • JS uses regularization to control user input bank card number and formatting

    Time:2019-6-6

    // JS regularization realizes the control and formatting of user input bank card number <script language=”javascript” type=”text/javascript”> function formatBankNo (BankNo){ if (BankNo.value == “”) return; var account = new String (BankNo.value); Account = account. substring (0,22); /* total number of accounts, including spaces*/ if (account.match (“.[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{7}”) == null){ /* Contrast format*/ if (account.match (“.[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{7}|” + […]

  • 15 commonly used javaScript regular expressions (collection)

    Time:2019-6-5

    1 user name rule // Regular username, 4 to 16 bits (letters, numbers, underscores, minus sign) var uPattern = /^[a-zA-Z0-9_-]{4,16}$/; // Output true console.log(uPattern.test(“iFat3”)); 2 cipher strength rule // Regular password strength, minimum 6 bits, including at least 1 capital letter, 1 lowercase letter, 1 digit, 1 special character var pPattern = /^.*(?=.{6,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[[email protected]#$%^&*? ]).*$/; // […]

  • Examples of Two Regular Replacement Functions Implemented by JS and C#

    Time:2019-5-30

    This paper illustrates two regular replacement functions implemented by JS and C#. Share for your reference, as follows: Application Example 1: The string to be processed: STR = “display = Test name = Mu display = temp” Requirement: Change the value after display = to localhost JS processing method: str.replace(/display=\w*/g,”display=localhost”); C# Processing Method: Regex reg=new […]

  • Native JS realizes rolling effect of announcement

    Time:2019-5-27

    In this paper, we share the specific code of rolling display of announcement in JS for your reference. The details are as follows. 1.html structure <body> <div> <ul> <li> I’m Announcement 1.</li> <li> I’m Announcement 2.</li> <li> I’m Announcement 3.</li> <li> I’m Announcement 4.</li> </ul> </div> </body> 2.css style <style type=”text/css”> body, div, ul, li […]

  • Examples of Picture Selection Sequence Switching and Circular Switching Functions Implemented by JS [Testing Availability]

    Time:2019-5-25

    In this paper, an example is given to illustrate the functions of JS in switching sequence of picture selection and cyclic switching. Share for your reference, as follows: <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> < title > picture switching </title > <style type=”text/css”> #box{width:400px;margin:0 auto;} […]

  • An in-depth analysis of regular expressions in JS

    Time:2019-5-25

    Reading catalogue Creation of Regular Expressions Special Characters in Regular Expressions \ (Backslash) ^ $ * (decimal point) ? (question mark) (x) (?:x) x(?=y), x(?!y), x|y {n}, {n,m}: [xyz], [^xyz] Other Regular expression flags Regular expression usage Most of the time, they are confused by regular expressions. Recently, they have taken the time to study […]

  • JavaScript Regular Method Replace for Highlighting Search Keyword

    Time:2019-5-3

    Preface Regular expressions are powerful tools in string processing tools. Others think they’re just a little toy, but they can’t do without them anyway. This paper introduces the replacement method of regular expressions in JavaScript and the function of searching keyword highlighting. First, we introduce the replacement method of regular expressions. Introduction to replace Introduction […]

  • Realization of Romantic Meteor Rain Animation by CSS and JS

    Time:2019-5-2

    1. Effects 2, source code HTML < body > < div class = “container” > < div id = “mask” > </ div > < div id = “sky” > </ div > < div id = “moon” > </ div > < div id = “stars” > </ div > < div class = […]

  • Examples of random generation of high-strength passwords in JS and SQL

    Time:2019-4-30

    This paper illustrates the random generation of high-strength passwords by JS and SQL. 分享给大家供大家参考,具体如下: JS mode <!DOCTYPE html> <html> <head> <meta charset=”UTF-8″> < title > Random generated password </title > </head> <body> <input type= “button” onclick= “RanPwd ()” value= “generate password”/> <span></span> <script> var numChar = [‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, […]

  • The Use and Basic Grammar of Regular Expressions in Javascript

    Time:2019-4-30

    Front words Regular expressions may be an incomprehensible bunch of characters in people’s minds, but it is these symbols that enable efficient string manipulation. Usually, the problem itself is not complicated, but without regular expressions it becomes a big problem. Regular expressions in JavaScript are very important knowledge. This article will introduce the basic grammar […]

  • The Concept and Application of Regular Expressions in JavaScript

    Time:2019-4-29

    Today I share some knowledge about regular expressions and their applications in javascript. Regular expressions are simple but not simple. For example, when my teacher told us before, he said that he would be proficient in this thing in twenty or thirty minutes. If he didn’t, he would not be able to make up for […]

  • JavaScript matches the regular expression code annotated in JS

    Time:2019-4-23

    Sometimes we need to get rid of JS comments to reduce redundancy in the code. Sometimes too many comments lead to large pages. The illustrations of the notes are as follows: 1. Matching multi-line annotated regular expressions: /(?:^|\n|\r)\s*\/\*[\s\S]*?\*\/\s*(?:\r|\n|$)/g 2. Single-line annotated regular expressions: /(?:^|\n|\r)\s*\/\/.*(?:\r|\n|$)/g The above content is introduced, I hope you will support developpaer […]