1
0
mirror of synced 2024-11-24 04:20:10 +01:00
TaikoSoundEditor/Commons/Extensions/StringExtensions.cs
2023-10-01 19:40:41 +03:00

21 lines
480 B
C#

using System.Text.RegularExpressions;
namespace TaikoSoundEditor.Commons.Extensions
{
internal static class StringExtensions
{
public static Match Match(this string s, string regex, string options="")
{
var opts = RegexOptions.None;
if (options.Contains("i")) opts |= RegexOptions.IgnoreCase;
var r = new Regex(regex);
if (!r.IsMatch(s)) return null;
return r.Match(s);
}
}
}