Python is learning a

Source: Internet
Author: User

The metacharacters. ^ $ * + ? {}. The match is: If a match is written to a point, if you match more than one word, write a few dots >>> a = re.findall (' b...dd ', ' BSSSDD ') >>> print (a) [' BSSSDD '] such as: > A = Re.findall (' B.. DD ', ' BSSSDD ') >>> print (a) [] explanation: Since the two points need to match the middle there are three causes that cannot match the ^ expression:>>> re.findall (' ^a. S ', ' abcsassss ') [' ABCs ']>>> re.findall (' A. S ', ' abcsassss ') [' ABCs ', ' asss ']>>> re.findall (' ^a. S ', ' abcsassss ') [' ABCs ']>>> if the comma contains a matching one, if ^ outside the comma is the maximum match content. The only thing that can be satisfied is to match it. The $ match is a match from the last start, if there is a hint empty, if there is a:>>> re.findall (' a.b$ ', ' Abbdddddabb ') [' ABB ']>>> re.findall (' $a. B ', ' Abbdddddabb ') []* match: Indicates: If the match succeeds, the last character will be the maximum to match the content:>>> re.findall (' abc* ', ' SABCCCC ') [' ABCCCC ']>>> Re.findall (' abc* ', ' SABCCCGEWEC ') [' ABCCC ']>>>? Expression: If the match succeeds stop matching;>>> re.findall (' abc? ', ' ABCCC ') [' abc ']>>> re.findall (' abc+ ', ' ABCCC ') [' ABCCC '] >>> re.findall (' abc* ', ' ABCCC ') [' ABCCC ']>>> re.findall (' abc? ', ' ABCCC ') [' abc ']{} match rule: Now conditions such as: {1,3} Indicates that only one of the above can be satisfied. The first number needs to be less than the second one otherwise it will go wrong >>> re.findall (' Abc{1,4} ', ' ABCCC ') [' ABCCC ']>>>>>> re.findall (' abc{1,4} ', ' ABCCCCCCCCCCCCCCCC ') [' ABCCCC ']>>> Re.findall (' abc{1,2} ', ' ABCCCCCCCCCCCCCCCC ') [' ABCC '] meta character appended character set []: Indicates that there are several values in the relationship, but only one, such as non-additive {to limit length matching}>>> Re.findall (' A[b,c]{1}d? ', ' abcddssaddddd ') [' AB ']>>>

Python is learning one

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.