Just put the pieces you want to be able to extract into groups by wrapping them in an extra set of ()
. For example:
^(?=.*\b((?:averages?|standard|means?))\b)(?=.*\b((?:goods?))\b)(?=.*\b((?:costs|cost to the company|sold by vendors?|bought from vandors?))\b).*$
When matching this string:
What is average goods costs.
average
, goods
and costs
become the first, second and third group in your match.
Try playing with it here:
http://rubular.com/r/urb1raJ3W7
You can try different test strings and see what groups it will extract.
Then in .NET you can use Match.Groups to access the groups in a match. You can even name the groups if you want for easier maintanence.