using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"""28"": (true|false)";
string input = @"{""1"": true, ""2"": true, ""3"": true, ""4"": true, ""5"": true, ""6"": true, ""7"": true, ""8"": true, ""9"": true, ""10"": true, ""11"": true, ""12"": true, ""13"": true, ""14"": true, ""15"": true, ""16"": true, ""17"": true, ""18"": false, ""19"": false, ""20"": false, ""21"": false, ""22"": false, ""23"": false, ""26"": false, ""27"": false, ""28"": false, ""29"": false, ""30"": false, ""31"": false, ""32"": false, ""33"": false, ""34"": true, ""35"": true, ""36"": false, ""37"": true, ""38"": true, ""39"": false, ""40"": false, ""41"": false, ""42"": false, ""81"": false, ""82"": false}";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
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