Skip to content

Commit

Permalink
Updates to ParseLinksUtility
Browse files Browse the repository at this point in the history
Adds support for hyphinated host names in ParseLinksUtility
Exposes ParseLinksUtility as public

Original feature request/bug report can be found here: #2
SendSafely-GitHub committed Aug 31, 2018
1 parent 98e5f77 commit ca699ac
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions SendsafelyAPI/Utilities/ParseLinksUtility.cs
Original file line number Diff line number Diff line change
@@ -5,10 +5,17 @@

namespace SendSafely.Utilities
{
class ParseLinksUtility
/// <summary>
/// Utility for extracting a list of valid SendSafely package links from text input.
/// </summary>
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\\-_]+)";

/// <summary>
/// Extract a list of valid SendSafely package links from text.
/// </summary>
/// <param name="text"> The text input that you want to check for package links.</param>
public List<String> Parse(String text)
{
List<String> links = new List<String>();
@@ -21,10 +28,10 @@ public List<String> Parse(String text)
{
links.Add(match.Value);
}

}

return links;
return links;
}
}
}
}

0 comments on commit ca699ac

Please sign in to comment.