Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Example Analysis of positive and negative pre-check in regular expression

Shulou Source: shulou.com Published: 2022-06-02 04:42:10 10月01日 Update

This article mainly shows you the "sample analysis of positive and negative pre-checking in regular expressions". The content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn the "positive and negative pre-check sample analysis in regular expressions".

In daily work, most of the search work that comes with IDE can meet most of the needs.

With regular matching, it's like a tiger's wing. It doesn't matter if you match an email address or a phone number. Sometimes we may encounter slightly special situations.

Windows 1.03 and Windows 2.0 fisrt Released in 1985 and 1987 respectively.

Windows 95 and Windows 98 are the successor.

Then Windows 2000 and Windows Xp Windows appeared.

Windows Vista is the Latest version of the family.

For example, in the above paragraph, there are several scenes.

1. We want to match the Windows followed by the numeric version number of the Windows and these characters. Such as Windows 1.03 and so on.

Equivalent?: that is, Windwos (?: [\ d.] +\ b) as shown in the following figure, this is a direct match, which matches Windows 1.03, Windows 95, Windows 98, but does not match Windows Xp, Windows Vista, etc.

2. We only want to match the 'Window' that meets these conditions, but not the following characters

He matched the spaces of Windows with (? = pattern), that is, Windows (? = [\ d.] +\ b). This process is forward matching.

3. If I want to match these Windows fields, it is not followed by a number or version number, I will use it instead

(?! pattern), that is, Windows (?! [\ d.] +\ b) this process is called forward matching dissatisfaction (which I think is easy to understand), which is not followed by a Windows that satisfies pattern ([\ d.] +\ b).

4. I want to match the Windows with a number in front of Windows. We use (?

It matches all Windows except the Windows after 11 (excluding the Windows at the beginning of the line).

With regard to the zero-width assertion, I think it makes people feel very academic and difficult to understand. My understanding is that characters matched by regular expressions before or after keywords are not displayed and are not used as regular subqueries. It only serves as a judge.

The above is all the contents of the article "sample Analysis of positive and negative pre-checking in regular expressions". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Number regular expression example analysis content character article scene version process study work help special not easy needless to say like a tiger to add power function key Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno MariaDB Shulou Tech Info Xiaomi