| 1234567891011121314151617181920212223 |
- using System.Text.RegularExpressions;
- namespace VberZero.Tools;
- public static class UrlChecker
- {
- private static readonly Regex UrlWithProtocolRegex = new Regex("^.{1,10}://.*$");
- public static bool IsRooted(string url)
- {
- if (url.StartsWith("/"))
- {
- return true;
- }
- if (UrlWithProtocolRegex.IsMatch(url))
- {
- return true;
- }
- return false;
- }
- }
|