Skip to content

Instantly share code, notes, and snippets.

@vendettamit
Created June 17, 2013 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vendettamit/5797807 to your computer and use it in GitHub Desktop.
Save vendettamit/5797807 to your computer and use it in GitHub Desktop.
My Regex Collections
Testing websites:
http://www.regex101.com/r/yM3vL0
http://www.regexplanet.com/advanced/dotnet/index.html
UrlSourceOrLocalDriveWithRegex = @"(?i)\b^(https?|s?ftp)+:\/\/[aA-zZ]*[0-9]*|([aA-zZ]{1}:{1}\\{1}\b).*$";
Matches: Https://www.something.com, Ftp://somesource.com, sftp://securesource.com, http://moreurl.com, C:\path etc.
Unmatch: httpss://something.com, abcd://, c:, C,
SystemDriveOrUNCPathRegex = @"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+$"
Matches: c:\folder, \\server\folder
unmatch: c:, \\ser.vom etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment