using System.Collections.Generic; using System.Text.RegularExpressions; namespace DaJiaoYan.Utils { public static class Reg { public const string NUMBER = "\\d"; public enum Type { Number } private static readonly Dictionary map = new Dictionary() { { Type.Number, NUMBER }, }; public static bool Match(string s, Type t, RegexOptions options = RegexOptions.IgnoreCase) { var m = Regex.Match(s, map[t], options); return m.Success; } public static bool Match(string s, string t, RegexOptions options = RegexOptions.IgnoreCase) { var m = Regex.Match(s, t, options); return m.Success; } } }