Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-06-02 05:09:42 09月14日 Update

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)

Tags: Expression regular single result content sequence method knowledge experience learning help omni-directional clear secure success serial port person command character string Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft macOS Apple Shulou Tech Info MySQL