string[] companies = { "microsoft", "IBM", "oracle", "google", "apple", "facebook", "RIM" };//wildcard search to "%o%o%"Regex regex = new Regex("oo");var oo = companies.Where(c => Regex.IsMatch(c, "o.*o")).Select(c => c);var oo1 = from c in companieswhere (Regex.IsMatch(c, "o.*o"))select c;oo1.Write();
Here we are searching for company names containing two “o”, need not be consecutive.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.