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

How to discuss .NET Framework regular expressions in an all-round way

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

How to fully explore the .NET Framework regular expressions, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Regular expressions are usually a difficult knowledge point for less experienced programmers. The same is true for the understanding of .NET Framework regular expressions. Let's take a brief analysis of the various concepts.

Summary of experience related to learning .NET Framework

Performance Evaluation of various .NET Framework Command Line tools

Summary of the list of .NET Framework class libraries

Tips for .NET Framework Security Protection

Detailed introduction of .NET Framework Serial Communication

1.Regex represents an immutable .NET Framework regular expression class.

Regex r = new Regex ("\\ s2000")

2.Match represents the result of the .NET Framework regular expression matching operation. The Match method of Regex returns an object of type Match.

Regex r = new Regex ("abc")

Match m = r.Match ("123abc456")

If (m.Success)

{

Console.WriteLine (m.Index)

}

3.MatchCollection represents a successful non-overlapping matching sequence. Returned by the Regex.Matches method.

4.GroupCollection represents the combination of sets of groups captured by .NET Framework regular expressions that returns a single collection of captured groups. Is returned in the collection returned by the Match.Groups property.

Regex r = new Regex (); Match m = r.Match (); Console.WriteLine (m.Groups.Count)

A sequence of substrings captured by 5.CaptureCollection and returns a collection of captures performed by a single capture group.

6. The group Group inherits from Capture and captures the results of the group. Returned by Match.Groups (groupnum)

7.Capture contains results captured from a single subexpression

Regex r

Match m

CaptureCollection cc

Int posn, length

R = new Regex ("(abc) *")

M = r.Match ("bcabcabc")

For (int iTuno; m.Groups [I].

Value! = ""; iTunes +)

{

Cc = m.groups [I] .Captures

For (int j = 0 position j)

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

Development

Wechat

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

12
Report