Count of Matches

Hello, I’m using a variable Match that is a type of system.Text.RegularExpressions.Match. I need to count the number of matches then only take group (1) and the last group.

Match = Regex.Match(in_PdfTxt.tostring.Trim,“Water \w+\s(\d{2}/\d{2}/\d{4}\s\d{2}/\d{2}/\d{4})”)

if Match.success then “Count number of matches”, can someone please show me how to construct this “count number of matches”. thanks!

for a first support have a look here:

just check for some more details related to your questions
regex.matches (many matches) vs. regex.match (only the first match)

@ppr Thank you so much!! I didn’t even know there is a matchcollection type! now it works!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.