12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System.Text.RegularExpressions;
- namespace Ant.Service.Common
- {
-
-
-
- public class RegexHelper
- {
- #region 验证输入字符串是否与模式字符串匹配
-
-
-
-
-
- public static bool IsMatch(string input, string pattern)
- {
- return IsMatch(input, pattern, RegexOptions.IgnoreCase);
- }
-
-
-
-
-
-
- public static bool IsMatch(string input, string pattern, RegexOptions options)
- {
- return Regex.IsMatch(input, pattern, options);
- }
-
-
-
-
-
- bool IsEmail(string email)
- {
- Regex regex = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
-
- return regex.IsMatch(email);
- }
- #endregion
- }
- }
|