Reputation: 1167
I currently have a code in C# that counts for the occurrence of a single pattern
MatchCollection collection = Regex.Matches(readedLine, @"work=R");
countedChars = collection.Count;
What to do when I need to find or match a multiple set of string or pattern in a line. For example
if "work=R", "product=X" and "function=V" are all found in one line, then it will have 1 count automatically, otherwise, or if one of them does not match, it will not be counted.
Upvotes: 0
Views: 381
Reputation: 457
You want a lookahead, and probably with start and end line markers.
Here's an example: http://regexr.com/3f8pk
Otherwise, if you don't have to process a LOT of data, you can have three separate regex patterns, and see if your line matches all three.
Upvotes: 1