mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-14 04:58:33 +00:00
feat: Initial commit of RegexUtils
This commit is contained in:
parent
0c35e3225c
commit
ed299b8d4f
2 changed files with 35 additions and 0 deletions
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue