I have few user inputs which I am trying to compare via MatchCollection with different patterns I have i.e
When matching the two above, the match collection only yields/collects match for (id, bought) but ignores "goods" from the first block of pattern. It seems to be ignoring **?** mentioned at the end of every word goods?|items?|t hings?.
Any suggestions.
Thanks
Code:
string user = "\b(?:I|would|like|to|see|id|of|bought|good)\b";
but When I am matching string
string pattern = "^(?=.*\bgoods?|items?|things?\b)(?=.*\bbought\b)(?=.*\bid\b)(?=.*\btest\b).*$";
MatchCollection mat = Regex.Matches(pattern , user );
foreach (var item in mat)
{
Console.WriteLine(item.ToString());
}
Any suggestions.
Thanks