2023-10-01 18:40:41 +02:00
|
|
|
|
using System.Text.RegularExpressions;
|
2023-07-17 10:20:00 +02:00
|
|
|
|
|
2023-10-01 18:40:41 +02:00
|
|
|
|
|
|
|
|
|
namespace TaikoSoundEditor.Commons.Extensions
|
2023-07-17 10:20:00 +02:00
|
|
|
|
{
|
|
|
|
|
internal static class StringExtensions
|
|
|
|
|
{
|
|
|
|
|
public static Match Match(this string s, string regex, string options="")
|
|
|
|
|
{
|
|
|
|
|
var opts = RegexOptions.None;
|
2023-10-01 18:40:41 +02:00
|
|
|
|
if (options.Contains("i")) opts |= RegexOptions.IgnoreCase;
|
2023-07-17 10:20:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var r = new Regex(regex);
|
|
|
|
|
if (!r.IsMatch(s)) return null;
|
|
|
|
|
return r.Match(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|