mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 12:45:01 +00:00
feat: Initial commit of RegexUtils
This commit is contained in:
@@ -116,6 +116,7 @@
|
|||||||
<Compile Include="Properties\Annotations.cs" />
|
<Compile Include="Properties\Annotations.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="RecursionUtils.cs" />
|
<Compile Include="RecursionUtils.cs" />
|
||||||
|
<Compile Include="RegexUtils.cs" />
|
||||||
<Compile Include="ReprBuilder.cs" />
|
<Compile Include="ReprBuilder.cs" />
|
||||||
<Compile Include="Services\Scheduler\AbstractScheduledAction.cs" />
|
<Compile Include="Services\Scheduler\AbstractScheduledAction.cs" />
|
||||||
<Compile Include="Services\Scheduler\ActionSchedulerService.cs" />
|
<Compile Include="Services\Scheduler\ActionSchedulerService.cs" />
|
||||||
|
|||||||
34
ICD.Common.Utils/RegexUtils.cs
Normal file
34
ICD.Common.Utils/RegexUtils.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace ICD.Common.Utils
|
||||||
|
{
|
||||||
|
public static class RegexUtils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Shim to perform Match and Matches in one call.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <param name="pattern"></param>
|
||||||
|
/// <param name="match"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool Matches(string input, string pattern, out Match match)
|
||||||
|
{
|
||||||
|
match = Regex.Match(input, pattern);
|
||||||
|
return match.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shim to perform Match and Matches in one call.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <param name="pattern"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="match"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool Matches(string input, string pattern, RegexOptions options, out Match match)
|
||||||
|
{
|
||||||
|
match = Regex.Match(input, pattern, options);
|
||||||
|
return match.Success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user