Regular expression matches the middle of two special characters __ essays

Source: Internet
Author: User

Today in the use of regular expressions, to match two characters in the middle of the content, temporarily did not write out, and later found on the Internet, recorded.
Match two strings between A and b the string contains a and B:
Expression: a.*? B ("." Represents any character, ". "represents a match of 0 or more)
Example: Abaidu.comb
Result: Awww.apizl.comB
Match two strings between A and b the string contains a but does not contain B:
Expression: a.*? =B)
Example: Awww.apizl.comB
Result: Awww.apizl.com
Matches the string between two strings A and B and does not contain a and B:
Expression: (? <=a). *? =B)
This kind of writing does not understand, I guess is if not include the preceding matching character (? <= to match the start character), does not contain the following to match the character writing (. = end character to match)
Example: Awww.baidu.comB
Result: www.baidu.com

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.