← All source files

V17 / d6d373561692

RegexPatterns.cs

Lilith/Core/Extensions/RegexPatterns.cs

Unchanged from the preceding version
CS
using System.Text.RegularExpressions;

namespace Lilith.Core.Extensions;

/// <summary>Shared fixed patterns compiled by the regex source generator.</summary>
public static partial class RegexPatterns
{
    [GeneratedRegex(@"\S+")]
    public static partial Regex Words();

    [GeneratedRegex(@"\s+")]
    public static partial Regex Whitespace();

    [GeneratedRegex(@"Version\s+\d+", RegexOptions.IgnoreCase)]
    public static partial Regex VersionLabel();

    [GeneratedRegex(@"^\s*[#\s]*\d+(?:\.\d+)?%\s*$")]
    public static partial Regex InstallerProgress();

    [GeneratedRegex(@"\x1b\[[0-?]*[ -/]*[@-~]")]
    public static partial Regex AnsiEscape();

    [GeneratedRegex(@"(?<![\d.])(\d+(?:\.\d+)?)%")]
    public static partial Regex DownloadPercentage();

    [GeneratedRegex(@"^[A-Za-z0-9][A-Za-z0-9._:/@-]*$")]
    public static partial Regex ModelIdentifier();

    [GeneratedRegex(@"^[A-Za-z0-9][A-Za-z0-9._:/-]*$")]
    public static partial Regex OllamaModelIdentifier();
}