using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"#[NCRLTBUIOSFAGKP]\{(\d+):(#[NCRLTBUIOSFAGKP]\{\d+(?:;F)?\}|S|C|R)(:\d+)?\}";
string input = @"Ejemplos Válidos:
Ejemplo 1: #A{4:#S{520}:1}
Ejemplo 2: #A{4:#S{520;F}:2}
Ejemplo 3: #A{4:#S{520}:5}
Ejemplo 4: '#A{4:#S{520;F}:8}'!=''
Ejemplo 5: '#A{4:#S{520}:7}'!=''
Ejemplo 6: '#A{4:#S{520;F}:4}'=='A'
Ejemplos Inválidos:
Ejemplo 1: #A{354:#S{500;F}:1:F}
Ejemplo 2: #A{354;#S{500;F};1}
Ejemplo 3: #S{500";
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