Tag:regular

  • Regular expressions that you can understand (expressed in JavaScript)

    Time:2021-2-26

    I am a front-end minion, and I often use regular expressions in my work, so I took time to learn the basics of regular expressions. Today, I will share what I have learned with you. I will first show you some small examples to lead you to gradually understand regular expressions. Then, on the basis […]

  • Analysis of golang regular expression

    Time:2021-2-26

    Go (also known as golang) is a static, strongly typed and compiled language developed by Robert Griesemer, rob pike and Ken Thompson of Google. The syntax of go language is similar to that of C, but its functions include: memory security, GC (garbage collection), structure and CSP style concurrent computing. Robert Griesemer, rob pike and […]

  • Comments for regular expression matching code blocks

    Time:2021-2-25

    There are many ways to use regular internal logic short-circuit matching We use multi branching to exclude, like if else, we don’t need to write complete conditions.Sometimes, small and wide conditions can not only match the final goal, but also add to the cake regexp = /str|regexp|lineannotaion|blockannotation|tampstring/g let tmp=”, str = ` ${tmp+’\`’+”${}”+ `${tmp}`+ /*A*/ […]

  • Machine learning (5): Wu Enda’s notes

    Time:2021-2-19

    Logistic regression algorithm Logistic regression algorithm is the most popular and widely used algorithm. Different from linear regression algorithm, the result of logistic regression algorithm is discrete value, which can be understood as classification problem Classification is divided into two categories and multi categories. Let’s start with two categories. It is difficult to classify e-mail […]

  • Machine learning (6): Wu Enda’s notes

    Time:2021-2-18

    We have learned linear regression and logical regression before, but it may produce over fitting when it is applied to practice. Next, let’s see how to solve the problem of over fitting What is over fitting We still use the example of house price forecast to see the over fitting in linear regression (1) If […]

  • Regular expression matching principle

    Time:2021-2-16

    Matching principle Before we understand the principle of regular matching, let’s take a look at the regular matching engine. There are two main types of regular expression engines: DFA and NFA. DFA (deterministic finite automaton) deterministic finite automata NFA (non deterministic finite automaton)There is also POSIX NFA, which is based on the NFA engine specification […]

  • How regular expressions get your web pages stuck

    Time:2021-2-12

    summary Regular expression should be a frequently used skill in the work items of our schedule. In the process of doing some character matching and processing, it plays a great role. This article is mainly to explore how regular expressions affect the performance of our code through a performance problem I encountered in my work. […]

  • Matching, segmentation and replacement of 25 regular expressions in JavaScript serialization and greedy pattern

    Time:2021-2-9

    1、 Test method var dateStr = ‘2020-01-01’; var dateReg = /^\d{4}-\d{2}-\d{2}$/; console.log ( dateReg.test (datestr)); // test method is used to verify whether the regular expression format is satisfied Results of operation: 2、 Extracting regular expressions 1. Regular object.exec Var qqstr = Xiaoming: 15778945869, Xiaohu: 156786468, Xiaohong: 13848956123; var reg = /\d+/g; do{ var content […]

  • Maximum backtracking / recursion limit of PCRE

    Time:2021-2-8

    Today, tank asked a question about the following regular rules: Copy codeThe code is as follows: /<script>.*?<\/script>/i When the length of the string to be matched is greater than 100014, the correct result will not be obtained Copy codeThe code is as follows: $reg = “/<script>.*?<\/script>/is”; $STR = “< script > * * * * […]

  • Regular expression parsing, let you understand the regular expression

    Time:2021-2-5

    Regular expression is a hurdle that every programmer can’t get around, and it’s also the art that is most easily ignored. I believe that most programmers use regular expressions in their work just like I did before. They Google them, then copy them and change them. Regular gives programmers the feeling that it is difficult […]

  • Front end regular exercises

    Time:2021-1-30

    Exercises 1. Change get element by ID to hump name var str = ‘get-element-by-id’ const reg = /-\w/g const newStr = str.replace(reg, word => { console.log(word, ‘word12’) return word.substring(1).toUpperCase() }) console.log(newStr, ‘newStr’) // getElementById 2. Judge the telephone number function isPhone(tel) { var regx = /^1[34578]\d{9}$/; return regx.test(tel); } 3. Find repeated words var str […]

  • On the second parameter of replace in regular expression

    Time:2021-1-29

    grammar string.replace(RegExp,newVal) Parameter value RegExpmust. Regexp object that specifies the substring or pattern to replace. Note that if the value is a string, it is used as the direct text pattern to retrieve, rather than being converted to a regexp object first. newvalueRequired. Functions that replace text or generate replacement text. Return value StringA new […]