Tag:regular expression

  • JavaScript (E5, 6) regular learning summary learning, can see can not see!

    Time:2019-12-15

    1. overview Regular expression is a method to express text pattern (string structure). There are two ways to create: One is to use literals, with slashes for start and end. var regex = /xyz/ The other is to use the regexp constructor. var regex = new RegExp(‘xyz’); The main difference between them is that the […]

  • Deep analysis of sub patterns of regular expressions

    Time:2019-12-14

    First, let’s look at a PHP code: <?php $time = date (“Y-m-d H:i:s”); $pattern = “/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/i”; if(preg_match($pattern,$time,$arr)){ echo “<pre>”; print_r($arr); echo “</pre>”; } ?> Display results: Array ( [0] => 2012-06-23 03:08:45 ) Have you noticed that there is only one piece of data in the displayed result, that is, the time format that […]

  • Regular expressions that can write 1000 lines less

    Time:2019-12-13

    If you master regular expression skillfully, your development efficiency will be greatly improved. Regular expressions are often used to verify fields or arbitrary strings, such as the following JavaScript code to verify the basic date format: var reg = /^(\\d{1,4})(-|\\/)(\\d{1,2})\\2(\\d{1,2})$/; var r = fieldValue.match(reg); if(r==null)alert(‘Date format error!’); Here are 20 regular expressions that are often […]

  • Regular expressions are really 6, but you can’t write them

    Time:2019-12-13

    The purpose of this article is to tell the most boring basic knowledge in the most popular language. $1. character2. Repeat qualifier3. grouping4. escape5. conditions or6. interval Regular expressions can be used in almost all languages, whether it’s JavaScript on the front end, Java and C on the back end. They all provide corresponding interfaces […]

  • Implementation of combining element UI in Vue: restrict input box to only enter positive integer

    Time:2019-12-12

    Implementation of combining element UI in Vue: restrict input box to only enter positive integer If you think it will help you, please move your little finger to give me a compliment Decimal and negative numbers are prohibited in input (only positive integers are allowed) Practice 1: use the method of forbidding key press, mainly […]

  • 20 regular expressions must know (can let you write 1000 lines less code)

    Time:2019-12-12

    Regular expression describes a pattern of string matching, which can be used to check whether a string contains a certain seed string, replace the matched substring, or extract the substring that meets a certain condition from a string. When listing directories, *. TXT in dir *. TXT or LS *. TXT is not a regular […]

  • On the use of regular expressions

    Time:2019-12-11

    This article starts with: the official website of drunk tea (http://blog.lovecathy.cn/arti…) and the WeChat public’s “drunk tea”. I. Preface When you see regular expressions, the general first impression is that there are a series of characters that you can’t understand. There’s no basis to judge them. They look silly. In fact, it’s mainly because we […]

  • HTML highlighting keywords is troublesome

    Time:2019-12-10

    There is such a function: highlight keywords in the web page. The simple operation that we thought an innerHTML replace could implement, however, encountered many problems. This paper records these problems and the final perfect solution,I hope it can help those who have the same experience. If you are only interested in the results, ignore […]

  • Parsing HTML tags using ABAP regular expressions

    Time:2019-12-9

    The requirement is that I use a function of ABAP to read a string from the database. The content of the string is a web page. The form of the web page contains many hidden input fields. My task is to resolve the value of the input field whose name is svyvalueguid: fa163eef573d1ed89e89c7fe5e7c4715 The simplest […]

  • JavaScript regular expression Mini Book – Notes

    Time:2019-12-8

    Greedy mode: When using special symbols to modify matching times, there are several ways to make the same expression match different times, such as: ‘{m, n}’, ‘{m,}’, ‘?’, ‘*’, ‘+’, and the specific matching times depend on the matched string. This kind of expression with repeated matching indefinite times always matches as many times as […]

  • Common regular use notes

    Time:2019-12-7

    origin Regular expression is a sharp tool. When it is taken out, it is always harmless, but we often put it on the shelf because it is not so beautiful and impressive Basic knowledge Common metacharacters Identification Explain . Match any character except newline \w Match letters or numbers or underscores or Chinese characters, if […]

  • Analysis of regular expression replace principle (. Net) graph and text

    Time:2019-12-7

    I. opening Recently, replacement is often used, so I will come out to sort out. What I want to share here is the replacement principle in regular expressions. The first thing I want to declare is that the replacement principle mentioned here is the replacement principle in regular expressions in. Net. Let’s first look at […]