1
0
mirror of https://github.com/chylex/Query.git synced 2025-08-16 05:31:41 +02:00
Files
AppCalc
AppConv
AppMeme
AppWindows
Base
Utils
RegexUtils.cs
Base.csproj
Command.cs
CommandEventArgs.cs
CommandException.cs
IApp.cs
MatchConfidence.cs
Calculator
Query
.gitignore
Directory.Build.props
Query.sln
icon.ico
Query/Base/Utils/RegexUtils.cs
2024-08-05 20:42:15 +02:00

24 lines
744 B
C#

using System.Text;
using System.Text.RegularExpressions;
namespace Base.Utils;
public static class RegexUtils {
public const RegexOptions Text = RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.Compiled;
internal static string Balance(string escapedStart, string escapedEnd) { // \(((?>[^()]+|\((?<n>)|\)(?<-n>))+(?(n)(?!)))\)
return new StringBuilder()
.Append(escapedStart)
.Append("((?>[^")
.Append(escapedStart)
.Append(escapedEnd)
.Append("]+|")
.Append(escapedStart)
.Append("(?<n>)|")
.Append(escapedEnd)
.Append("(?<-n>))+(?(n)(?!)))")
.Append(escapedEnd)
.ToString();
}
}