Using c# vs2008
Regex
I am trying to get a number from a very long string loaded from text from a file.
In this source string there are multiple instances of the data i want to get out.
Eg. "Tax Invoice No INV1870507" may be repeated 10 times in the source String
, with any unknown number of characters between each match.
I want to get the number "1870507" out. The number is different for every different file I load and I need to find what the number is.
Using this pattern : (?<=Tax Invoice No[\s\r\n]+INV)(?'InvNo'[^\s\r\n]+)?
I can correctly get a match on every occurance and can read the number.
But I get like 10 matches and 10 groups.
I want the Regex
to short circuit at the first match and return only 1 match becasue then I have the info I need and there is no need to keep matching.
Can anyone please advise?