Get the first occurence of Regex

Hello All,
I used this regex to get all the matches of my reference:

System.Text.RegularExpressions.Regex.Match(DocText,“(?<=Reference)(\w+)(\d+)”).Value

i have three Matches , I want to get the first one,second , third in order towrite them in excel
Any help please

Hi,

Can you try Matches instead of Match as the following?

mc =System.Text.RegularExpressions.Regex.Matches(DocText,"(?<=Reference)(\w+)(\d+)")

Regards,

Hello @nora_ziani Please Refer this Post.

Write Index as 0,1,2 in order to get First, Second and Third Occurence of Regex.