Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report