1
0
mirror of synced 2024-11-27 21:10:48 +01:00
TaikoSoundEditor/Extensions/StringExtensions.cs

25 lines
587 B
C#
Raw Normal View History

2023-07-17 10:20:00 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace TaikoSoundEditor.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);
}
}
}