Csharp/C Sharp/Development Class/RegexCompilationInfo — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:43, 26 мая 2010
new RegexCompilationInfo(@"^\d{4}$",RegexOptions.Compiled, "PinRegex", "", true)
using System;
using System.Reflection;
using System.Text.RegularExpressions;
class MainClass
{
public static void Main()
{
RegexCompilationInfo[] regexInfo = new RegexCompilationInfo[2];
regexInfo[0] = new RegexCompilationInfo(@"^\d{4}$",RegexOptions.rupiled, "PinRegex", "", true);
regexInfo[1] = new RegexCompilationInfo(@"^\d{4}-?\d{4}-?\d{4}-?\d{4}$",RegexOptions.rupiled, "CreditCardRegex", "", true);
AssemblyName assembly = new AssemblyName();
assembly.Name = "MyRegEx";
Regex.rupileToAssembly(regexInfo, assembly);
}
}
Regex.CompileToAssembly
using System;
using System.Reflection;
using System.Text.RegularExpressions;
class MainClass {
public static void Main() {
RegexCompilationInfo[] regexInfo = new RegexCompilationInfo[2];
regexInfo[0] = new RegexCompilationInfo(@"^\d{4}$", RegexOptions.rupiled, "PinRegex", "", true);
regexInfo[1] = new RegexCompilationInfo(@"^\d{4}-?\d{4}-?\d{4}-?\d{4}$", RegexOptions.rupiled, "CreditCardRegex", "", true);
AssemblyName assembly = new AssemblyName();
assembly.Name = "MyRegEx";
Regex.rupileToAssembly(regexInfo, assembly);
}
}