| 12345678910111213141516171819202122232425262728293031 |
- 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<Type, string> map = new Dictionary<Type, string>()
- {
- { 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;
- }
- }
- }
|