Category:Regular Expression

  • Common regular expressions are more practical

    Time:2021-8-2

    Regular expression matching Chinese characters: [\ u4e00 – \ u9fa5]Comment: matching Chinese is really a headache. It’s easy to do with this expression Matching double byte characters (including Chinese characters): [^ \ X00 – \ XFF]Comment: can be used to calculate the length of a string (a double byte character length meter 2, ASCII character […]

  • JavaScript regular modifier

    Time:2021-8-1

    In fact, there is also a very important modifier, which is rarely mentioned in the articles found on the Internet. It is m. In regular JavaScript, after ^ matches the newline character by default and before $matches the newline character by default, use / ^. + $/ so that only one line can be matched. […]

  • C# regular expression classic classification collection manual page 1 / 3

    Time:2021-7-31

    There was a time when regular expression learning was very popular and trendy. At that time, I could see several regular expression posts in a day at CSDN. During that time, I learned some basic knowledge with the help of the forum and the c# string and regular expression reference manual published by Wrox press. […]

  • JS MAC address regular expression

    Time:2021-7-30

    Copy codeThe code is as follows: function CheckForm2() { //MAC address regular expressionvar reg_name=/[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}/; if(!reg_name.test(document.form2.mac.value)){ Alert (“MAC address format is incorrect! MAC address format is 00:24:21:19: BD: E4 “);document.form2.mac.focus(); return false; } return true; }

  • Regular expression formula to learn regular friends to see

    Time:2021-7-29

    Regular is a fortress that every programmer can’t get around. We have to attack it. I think the reason why regularization is difficult is that it needs memory, and the second is that it requires abstract logical thinking.Too many introductions signed on the Internet are fierce essays, which can be understood while watching, but can’t […]

  • JavaScript regexp object (regular expression)

    Time:2021-7-28

    Use the explicit constructor of regexp. The syntax is: new regexp (“pattern” [, “flags”]).Use the implicit constructor of regexp in plain text format: / pattern / [flags].The pattern part is the regular expression pattern text to be used, which is required. In the first method, the pattern part exists as a JavaScript string and needs […]

  • The difference between using test in Firefox and IE

    Time:2021-7-27

    Copy codeThe code is as follows: <script language=”javascript” type=”text/javascript”> function fun(){ document.write(/a/gi.test(“a”)); } fun() fun() </script> The execution result in IE is: truetrueThe execution result in Firefox is: true falseIn regular / expression / GI, G means global, and I means case insensitive.Generally, the global attribute is true, which is not good for test application. […]

  • Use JavaScript regular expressions marked with “g” correctly

    Time:2021-7-26

    Let’s talk about the use of regular expressions marked with “g”. First, let’s look at a piece of code, which is easier to understand from an example. Copy codeThe code is as follows: 1 function a(val) 2 { 3 var re = /^\d+$/g; 4 alert(re.lastIndex); 5 return re.test(val); 6 } 7 alert(a(5)); 8 alert(a(6)); Running […]

  • Regular expression learning materials

    Time:2021-7-24

    Common regular expressionshttps://www.jb51.net/article/17355.htm Advanced learning skills of regular expressionshttps://www.jb51.net/article/9229.htm 1.Introduction to regular expressions Regular expression(Regular expression,Abbreviated asRegexes)Is a powerful tool for manipulating and verifying string data. It is equivalent to a string of special characters, which can be converted into algorithms, text matching and other operations.        In fact, regular expressions have their own set […]

  • Summary of JavaScript regular expression usage

    Time:2021-7-23

    JavaScript regular expression usage: Copy codeThe code is as follows: function checkreg(myreg,mytext) { if(myreg.test(mytext) { alert(“ok”); return true; } else { return false; } } //Another way of writing Copy codeThe code is as follows: function checkreg(myreg,mytext) { var pattern = myreg; // Or var pattern = new regexp (myreg, “GI”);if(pattern.test(mytext)) { alert(“ok”); } } […]

  • Test function of regular matching

    Time:2021-7-22

    var fnTest = /xyz/.test(function(){xyz;}) ? / b_ superb/ : /.*/; I am very confused about the usage of the regular expression matching function test/xyz/.test(function(){xyz;}) I looked up the description of the test function in Mozilla Developer CenterExecutes the search for a match between a regular expression and a specified string. Returns true or false. Whether […]

  • Check whether the eight digit number is a valid date

    Time:2021-7-17

    Test whether the eight digit number is a valid date String : Regex : [Ctrl + a all optional note: to introduce external JS, you need to refresh the page again]