-
string[] result = Regex.Matches(Invoice, @"(?:^|\|)(""[^""]""|[^|])")
Find one or more results that match the regular expression in Invoice. In this example, the result obtained isB
,|K
,|L
-
Case<Match>
Convert it into a Match collection, which is convenient for further processing with linq in the subsequent code. -
Select(m => m.Groups[1].Value)
To get the first capture group in the regular expression, you can check the following post to understand this. Regular Expression Groups in C# The result of this step isB
,K
,L
. -
return result.Any(s => InvoiceID.Contains(s))
InvoiceID is a variable, I think it should be the parameter of this method. Check whether the InvoiceID contains one of the results of the third step. LikeB
,BS
, andKA
all return True.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.