I used to think regularization was very difficult , Don't use , Several methods have been tested today , Sort out and summarize , Simple and clear .

simply , Regular is   Extract a piece of feature data , use (.*?) Instead of .

The characteristics of my own summary & difference :

(.*) Greedy matching , It will match back as much as possible

(.*?) Non greedy matching , There will be as few matches as possible , Whether to add ? Affect the length of the matching result , This matching rule is often used


The following is a concrete example , You can look at it ~

 

Python: Regular expressions ( One ):search()、match()、findall() More articles about the difference between

  1. Python Regular expressions re.search(r'\*{3,8}','*****') and re.search('\*{3,8}','*****') Why is the match result of the same ?

    The old ape did the following tests : >>> re.search(r'\*{3,100}','*****') <re.Match object; span=(0, 5), match='**** ...

  2. python Regular expressions (4)--search Method

    1.re.search function re.search Scan the entire string and return the first successful match , If the match fails search() Just go back to None. (1) Function syntax : re.search(pattern, string ...

  3. python Regular expressions re.search

    #coding:utf-8 import re # Compile regular expressions into pattern object #compile(pattern, flags=0) #Compile a regular expression ...

  4. python re And search/match The difference

    search → find something anywhere in the string and return a match object. match → find something at ...

  5. python Regular expressions 02--findall() and search() Method difference ,group() Method

    import re st = 'asxxixxsaefxxlovexxsdwdxxyouxxde' #search() and findall() The difference between a = re.search('xx(.*?)xxsa ...

  6. Python Regular expressions re Module learning problems

    Python What are the groups that regular expressions deal with ? Python What are the matching objects in regular expression processing ? Python Match the object groups.groupdict and group The relationship between Python Regular expressions re.mat ...

  7. Python Regular expressions ( total )

    Reprint please indicate the source : http://www.cnblogs.com/why168888/p/6445044.html This article from the :[Edwin Blog Garden ] Python Regular expressions ( total ) search(patte ...

  8. python Regular expression basis , as well as pattern.match(),re.match(),pattern.search(),re.search() The use and difference of methods

    Regular expressions (regular expression) It's a special sequence of characters , Describes a pattern of string matching , Can be used to check whether a string contains a seed string . Replace or extract a matching substring from a string that meets a certain condition ...

  9. python Notes on reptiles re.match matching , And search、findall difference

    Why? re.match It doesn't match ?re.match How about the matching rules ?( Catch it seo) re.match(pattern, string[, flags]) pattern To match rules , That is, enter a regular expression . st ...

  10. python Basics -6.1 match search findall group(s) difference

    import re # match findall Frequently used # re.match() # Match from beginning , If no object is matched, return NONE # re.search() # Browse all characters , Match the first string that matches the rule ...

Random recommendation

  1. C++ Type conversion function

    1. What is a type conversion function Type conversion functions are used to convert objects of one class to data of another type . class testclass { private: int r; int m; public : testclass ...

  2. 【swift Learning notes 】 One . The condition judgment and value transmission of page Jump

    Before we jump to the page, we may judge whether we have entered the correct data , As shown in the figure below , If there is no data input, a prompt will pop up , No turning . One : Page Jump 1. Put one on the top of the first page Label One textfield And a button 2. In the ...

  3. [ASE][Daily Scrum]11.27

    View Shilin Liu Design death treatment Yiming Liao Handle tank- Bullet collision incident     Server Songtao He Fix when the bullet line is full bug Junbei Zhang The server ...

  4. iOS Develop tips -- Skillfully use ImageView Medium mode( Solve the problem that the picture is stretched )

    One . My own problems : In layout ImageView When , By constraining ImageView Good layout , But the pictures inside are stretched so hard to see . That's when it's used Mode attribute , Pictured : Code implementation : Two . Let the picture stretch to scale , Not at all ...

  5. SQL- Optimism lock , Pessimistic lock for concurrency

    Every time I blog , The first sentence is like this : Programmers are hard pressed , Besides being able to write programs , I have to be able to blog ! Of course , I hope one day in the future , Some boss saw this blog , Pay your programmer staff a little more ! Because the world of programmers is nothing but silence . Most programmers in my eyes don't ...

  6. HDU-4879-ZCC loves march(map+set+ Union checking set )

    Description On a m*m land stationed n troops, numbered from 1 to n. The i-th troop's position can be ...

  7. Image output onerror event

    <img src=".<?php echo $img[0];?>" onerror="this.src='img/zanwu.jpg'" st ...

  8. Manually create new MVC Controllers and views , And the problem of data display

    One , stay C#.NET Of MVC Add a controller to the project , In this controller there is a index Method , You can index Method right click and select Add view , This can create a system that contains index.cshtml Of View View folder < ...

  9. lambda Advanced -- Expression parameter

    1, Now we encapsulate a method , To provide a comparator , Obviously the comparator has two parameters -- Two values to compare . public class Linkin { public static String[] sort(Str ...

  10. Let's see how the gods solve some problems 【bng】 Where is it !!!!

    author : Yao Dong   encounter bng The share of I have done maintenance work of large software for two years , What are the advantages of that project 10 For many years , about 3000 More than ten thousand lines of code , Thousands of people have been involved in the development , Code checkout It's about a year out 5 individual GB, and bug Particularly many ,op ...