string text = @"Hello, my first name is ABC and my second name is DEF. Third name is GHI."; Regex regex = new Regex(@"first name is (?\w*) second name is (?\w*)"); Match match = regex.Match(text); string first = match.Groups["first"].ToString(); string second = match.Groups["second"].ToString(); string third = match.Groups["third"].ToString();