123456789101112131415161718 |
- using System.Text.RegularExpressions;
- namespace Team.Utility
- {
- public static class RegularHelper
- {
- public static bool CheckIpAddress(string ip)
- {
- if (string.IsNullOrWhiteSpace(ip))
- {
- return false;
- }
- Regex ipRegex = new
- (@"^((2[0-4]\d|25[0-5]|(1\d{2})|([1-9]?[0-9]))\.){3}(2[0-4]\d|25[0-4]|(1\d{2})|([1-9][0-9])|([1-9]))$");
- return ipRegex.IsMatch(ip);
- }
- }
- }
|