aAaErAX~~| 6A95G554VBCZWY

Regex.Matches` returns multiple Match objects. It matches multiple instances of a pattern and returns a MatchCollection. It is useful for extracting values, based on a pattern, when many are expected.`To start,` this program includes the System.Text.RegularExpressions namespace. It uses an input string that contains several words. Each one starts with the letter s. Next, we use Regex.Matches on this string. `Pattern: `This will only match words starting with the letter s, with one or more non-whitespace characters, and ending in a lowercase d.`Foreach: `We use foreach on the MatchCollection, and then on the result of the Captures property.`Foreach loop.` Above we use the foreach-loop on the MatchCollection returned by Regex.Matches. To access the individual pieces matched by the Regex, we need to loop over the Captures collection. `Foreach `foreach`Finally: `We can access the Value property to get the actual string. The Index property tells us the character position of the capture.`Matches vs. Match.` With Regex.Matches, we gather a group of matches (a MatchCollection) which must be iterated over. If only one Match is needed, Regex.Match is simpler to use. And the simplest method is typically best. `Regex `regex`Summary.` The Regex.Matches method provides a way for you to match multiple times in a single input string. You can then loop over these matches and their individual captures to get all the results. It is similar to Regex.Match. `Doing this sort of text processing would be more cumbersome if you were to use methods such as IndexOf and Split.`IndexOf `indexof`Split `split

AONHDNNODOQ;NODOQ.O$ObOJOAN{NAO%A{DNAAO{Input OP.NAADconst OP OhOyD@Hsaid shed see spear spread superH;DNNAAO{Oka cO) of matches.NAADMatchCO) matchesOyDOY.MatchesD(Oh, D@Hs\w+dHD);DNNAAO{Use O@-loop.NAADO@D (Match matchOpmatches)NAA{NAAADO@D (Capture captureOpmatch.Captures)NAAA{NAAAAO'DHOT={0}, OX={1}HD, capture.OT, capture.OX);NAAA}NAA}NA}N}NNDNNOT=0, OX=saidNOT=5, OX=shedNOT=20, OX=spreadD

!dRegex.Matches method