From ed299b8d4fb1a7b77b1a0ca4ce8fb6aaedfa0761 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Fri, 31 Aug 2018 09:52:53 -0400 Subject: [PATCH] feat: Initial commit of RegexUtils --- .../ICD.Common.Utils_SimplSharp.csproj | 1 + ICD.Common.Utils/RegexUtils.cs | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 ICD.Common.Utils/RegexUtils.cs diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj index 697ba65..289cef7 100644 --- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj +++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj @@ -116,6 +116,7 @@ + diff --git a/ICD.Common.Utils/RegexUtils.cs b/ICD.Common.Utils/RegexUtils.cs new file mode 100644 index 0000000..1b294d2 --- /dev/null +++ b/ICD.Common.Utils/RegexUtils.cs @@ -0,0 +1,34 @@ +using System.Text.RegularExpressions; + +namespace ICD.Common.Utils +{ + public static class RegexUtils + { + /// + /// Shim to perform Match and Matches in one call. + /// + /// + /// + /// + /// + public static bool Matches(string input, string pattern, out Match match) + { + match = Regex.Match(input, pattern); + return match.Success; + } + + /// + /// Shim to perform Match and Matches in one call. + /// + /// + /// + /// + /// + /// + public static bool Matches(string input, string pattern, RegexOptions options, out Match match) + { + match = Regex.Match(input, pattern, options); + return match.Success; + } + } +}