Category:Regular Expression

  • Learn regular! Simple examples of hyperbasic

    Time:2020-11-25

    The problem is, in some cases, we should give: http://jb51.net?a=1 This kind of URL address appending parameter becomes: http://jb51.net?a=1&b=2 But how do you know that the same parameter name already exists? For example, in this case: http://jb51.net?a=1&a=2 This is not a big mistake, but the address bar doesn’t look good. Then what shall I do? […]

  • Regular expressions that match 5 to 10 non repeating digits

    Time:2020-11-24

    For repeated 5 to 10 digit numbers, you can use a regular pattern such as {5,10} No repetition of 5 to 10 digits, I think about it, not yet, but I have to check the Internet. There was a good version, but regexbuddy passed the test anyway. Copy codeThe code is as follows: ^(?!\d*?(\d)\d*?\1)\d{5,10}$ For […]

  • DW finds a regular expression for all characters before a string

    Time:2020-11-23

    When I write HTML with DW editor, I like to write comments, such as comments on <! — header >, and so on. When a large change is made, I need to search and replace in batch. In order to operate in batch, I write a regular expression to process it. Find: Copy codeThe code […]

  • Using regular search for HTML tags with ID attribute

    Time:2020-11-22

    For example:String < div style=“ float:left “>123213</div><div>21314423</div>Mismatch < div > Contents of < / div > This example can be used to write this example<[a-zA-Z0-9][^>]+?id=[^>]+?>.*?</div> matching The previous PHP example: Copy codeThe code is as follows: <?php $str = ‘<div style=”float:left”>123213</div><div>213123</div>’; $search = ‘#<[a-zA-Z0-9][^>]+?id=[^>]+?>.*?</div>#is’; preg_match_all($search,$str,$r); echo ‘<pre>’; print_r($r); echo ‘</pre>’; ?> This example outputs Copy […]

  • Introduction to the use of pattern modifiers in regular expression tutorial

    Time:2020-11-21

    Previously, we introduced the delimiters, atoms and metacharacters in regular expressions, so the basic syntax of the regular expression tutorial is left with the pattern modifier in regular expressions. This section will introduce the concept of pattern modifier, the composition of pattern modifier, and the demonstration of pattern modifier combined with examples. After learning this […]

  • Regular expressions that allow only a few characters in a URL

    Time:2020-11-20

    For example, the restriction allows only the followinga-Z 0-9 Http: / / match coherenceHTTPS: / / match coherence/It is not allowed to appear two times in succession& % ? do not appear two times in succession=Equal sign-Middle dashA kind of Underline. points are important There are the following regular coincidence ^((?:http|https)://)?((?![/?]{2,})[a-zA-Z0-9\-._%&=/?])+$ Regexbuddy3 translation tool ^((?:http|https)://)?((?![/?]{2,})[a-zA-Z0-9\-._%&=/?])+$ […]

  • Perfect email verification regular expression

    Time:2020-11-18

    The format of international domain name is as follows:The domain name is composed of any combination of the specific character set, English letters, numbers and “-” (i.e. hyphen or minus sign), but the beginning and end of the domain name can not contain “‘”, and “-” cannot appear continuously. Letters in domain names are not […]

  • Editplus3 makes the function fully display

    Time:2020-11-17

    I often use EDITPLUS, mainly because of its fast startup, small files, custom code, green. It is found that when you open PHP with it, you can open the function list by pressing Ctrl + F11, that is, all the function names in the file will be displayed in the list, and double-click will select […]

  • A regular expression is actually a special string

    Time:2020-11-16

    Java regular expression provides a rich class library, which greatly simplifies the process. The following is a list of common basic syntax:* + ? ^$[] () | / \ \ D / D / w / w {} {n} {n, m}, etc,Note the “|” or symbol. It can match single characters and strings. For example: […]

  • Regular use (? & gt )Realize curing grouping and improve efficiency

    Time:2020-11-15

    Specifically, use (? >) )”Is no different from a normal match, but if the match goes after this structure (that is, after the closed parentheses), all the standby states in the structure are discarded (cannot be backtracked).That is to say, at the end of solidification group matching, the matched text has been solidified into a […]

  • Regular matching of hexadecimal in programming language

    Time:2020-11-14

    It consists of 0-9, a-f. The corresponding relationship with decimal system is: 0-9 corresponds to 0-9; A-F corresponds to 10-15; the number of n-base can be represented by 0 – (n-1), and the letters A-F are used for those exceeding 9. That is, it is composed of the characters 012345679abcdef A hexadecimal number in C […]

  • Regular expression solving binary equation code

    Time:2020-11-13

    Original text: http://blog.stevenlevithan.com/archives/algebra-with-regexesI really calculated the result according to the regularity written in the original text. PHP example: Copy codeThe code is as follows: <?php/*** calculate ax + by = C */function suan($A, $B, $C) { $A–; $B–; $str = str_repeat(‘-‘, $C); $search = ‘/^(.*)\1{‘ . $A . ‘}(.*)\2{‘ . $B . ‘}$/’; preg_match($search, $str, $r); return array(‘x’ => strlen($r[1]), ‘y’ => […]