added more utilty packges

This commit is contained in:
Sebastian Bularca
2026-03-29 18:59:24 +02:00
parent ee97b2fec3
commit 71b432e253
131 changed files with 7674 additions and 54 deletions

View File

@@ -0,0 +1,24 @@
using System.Linq;
using System.Text.RegularExpressions;
namespace InspectorToolkit
{
public static class MyRegex
{
public const string WholeNumber = @"^-?\d+$";
public const string FloatingNumber = @"^-?\d*(\.\d+)?$";
public const string AlphanumericWithoutSpace = @"^[a-zA-Z0-9]*$";
public const string AlphanumericWithSpace = @"^[a-zA-Z0-9 ]*$";
public const string Email = @"^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$";
public const string URL = @"(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)";
/// <summary>
/// Replace all but matching parts of the input string
/// </summary>
public static string KeepMatching(this Regex regex, string input) => regex.Matches(input).Cast<Match>()
.Aggregate(string.Empty, (a, m) => a + m.Value);
}
}