June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to find every time a certain pattern occurs in a string and retrieve the corresponding text.
Use the Regex.Matches method to retrieve a collection with all the matches in a string.
The System.Text.RegularExpressions namespace defines two classes that are used with matches. The Match class represents a single match and contains information such as the position in the string where the match was found, the length, and the text of the match. The MatchCollection class is a collection of Match instances. You can retrieve a MatchCollection that contains all the matches for a specific regular expression by calling Regex.Matches and supplying the search text.
The following example ...
Read now
Unlock full access