RegexService.cs 514 B

123456789101112131415161718
  1. using System.Text.RegularExpressions;
  2. namespace Alchemy.Core.Services
  3. {
  4. public class RegexService
  5. {
  6. /// <summary>
  7. /// 判断正则表达式
  8. /// </summary>
  9. /// <param name="strRaw"></param>
  10. /// <param name="strFormat"></param>
  11. /// <returns></returns>
  12. public static bool IsMatch(string strRaw, string strFormat)
  13. {
  14. Regex regex = new Regex(strFormat, RegexOptions.None);
  15. return regex.IsMatch(strRaw);
  16. }
  17. }
  18. }