From ca699ac5cb10a07c13936188a63e367bee3f077c Mon Sep 17 00:00:00 2001 From: SendSafely Date: Fri, 31 Aug 2018 15:03:40 -0400 Subject: [PATCH] Updates to ParseLinksUtility Adds support for hyphinated host names in ParseLinksUtility Exposes ParseLinksUtility as public Original feature request/bug report can be found here: https://github.com/SendSafely/Windows-Client-API/pull/2 --- SendsafelyAPI/Utilities/ParseLinksUtility.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/SendsafelyAPI/Utilities/ParseLinksUtility.cs b/SendsafelyAPI/Utilities/ParseLinksUtility.cs index f0f3610..e6e8012 100644 --- a/SendsafelyAPI/Utilities/ParseLinksUtility.cs +++ b/SendsafelyAPI/Utilities/ParseLinksUtility.cs @@ -5,10 +5,17 @@ namespace SendSafely.Utilities { - class ParseLinksUtility + /// + /// Utility for extracting a list of valid SendSafely package links from text input. + /// + public class ParseLinksUtility { - private String REGEX = "(https:\\/\\/[a-zA-Z\\.]+\\/receive\\/\\?[A-Za-z0-9&=\\-]+packageCode=[A-Za-z0-9\\-_]+#keyCode=[A-Za-z0-9\\-_]+)"; + private String REGEX = "(https:\\/\\/[a-zA-Z\\.-]+\\/receive\\/\\?[A-Za-z0-9&=\\-]+packageCode=[A-Za-z0-9\\-_]+#keyCode=[A-Za-z0-9\\-_]+)"; + /// + /// Extract a list of valid SendSafely package links from text. + /// + /// The text input that you want to check for package links. public List Parse(String text) { List links = new List(); @@ -21,10 +28,10 @@ public List Parse(String text) { links.Add(match.Value); } - + } - return links; + return links; } } -} +} \ No newline at end of file