| 1 | using System; |
| 2 | using System.Collections.Generic; |
| 3 | using System.Linq; |
| 4 | using System.Text; |
| 5 | using System.Text.RegularExpressions; |
| 6 | using System.Threading.Tasks; |
| 7 | |
| 8 | namespace Core.Librarys |
| 9 | { |
| 10 | public static class RegexHelper |
| 11 | { |
| 12 | ///<summary> |
| 13 | /// |
| 14 | ///</summary> |
| 15 | ///<param name="input"></param> |
| 16 | ///<param name="pattern"></param> |
| 17 | ///<returns></returns> |
| 18 | public static bool IsMatch(string input, string pattern) |
| 19 | { |
| 20 | try |
| 21 | { |
| 22 | return Regex.IsMatch(input, pattern); |
| 23 | } |
| 24 | catch (Exception ex) |
| 25 | { |
| 26 | Logger.Error("正则表达式错误。" + ex.ToString()); |
| 27 | return false; |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | } |