1
0
mirror of synced 2024-12-18 04:45:55 +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);
}
}
}