Empty string Assertion

Source: Internet
Author: User

Recently, the following regular expressions were studied, and a regular expression 30-minute introductory tutorial was read online.

Tutorial point here ~ 30 minutes to get started

Speaking in the balance group (?!) Assert that a certain match isunsuccessful ...

Thought for a long while do not understand .... I understand that (?!) Assert the ...

A (?! b) can match A to the right not B, that a (?!) It means matching a to the right.

Then I entered the Qwea found not match. It feels very strange ... Tangled up 2, 3 days ... Later found that I understand the wrong ....


The correct understanding should be a match to the right is not an empty string ... Empty strings exist everywhere, such as "ABC" has 4 empty strings, a front and back, C front and back. to a (?!) The understanding should be match A to the right is not an empty string, because the right side of a must have an empty string, so the match must fail. All four assertions have this feature.


(?!) and (? <!) Must have been a failure.

(?! =) and (? =) must be successful.


The meaning of this usage is that the regular expression can fail according to the situation. In the balance group, if some characters appear unequal, you can use this technique to force the match to fail .... Language is a little difficult to describe, put an example of it ... I think it's a good story.

Https://msdn.microsoft.com/zh-cn/library/bs2twtah (v=vs.110). aspx


It's almost like that.

Empty string Assertion

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.