using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @".*Summer.*";
string input = @"_id"": ObjectId(""001""),
""searchkey"": ""Test Product Test Product T-shirt Half sleeves Adidas""
}
{
""_id"": ObjectId(""123""),
""searchkey"": ""boy test Product Test Product T-shirt Half sleeves Nike""
}
{
""_id"": ObjectId(""456""),
""searchkey"": ""girl test Product Summer Product T-shirt full sleeves Adidas""
}
{
""_id"": ObjectId(""789""),
""searchkey"": ""any product any Product any Product T-shirt full sleeves Adidas""
}
{
""_id"": ObjectId(""1010""),
""searchkey"": ""woodland Product woodland Product T-shirt Half sleeves woodland""
}
{
""_id"": ObjectId(""1212""),
""searchkey"": ""Summer Product Test Product T-shirt Half sleeves Adidas";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx