Category:Regular Expression

  • Learn regular! Simple examples of hyperbasic


    The problem is, in some cases, we should give: This kind of URL address appending parameter becomes: But how do you know that the same parameter name already exists? For example, in this case: 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


    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


    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


    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


    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


    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


    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


    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


    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


    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


    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


    Original text: 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’ => […]