/* * Karinto Library Project * * This software is distributed under a zlib-style license. * See license.txt for more information. */ using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace Karinto { public static class RegexSet { #region constructor static RegexSet() { string invalidPathChars = ""; foreach (char c in System.IO.Path.GetInvalidPathChars()) { invalidPathChars += c; } InvalidPathChars = new Regex(@"[" + Regex.Escape(invalidPathChars) + @"]", RegexOptions.Compiled); } #endregion #region number public static readonly Regex DecimalFloat = new Regex(@"([-+]?(?:\d+([\.,]\d*)?|([\.,]\d+))([eE][-+]?\d+)?)$", RegexOptions.Compiled); public static readonly Regex HexInteger = new Regex(@"(?:(?:0x)?(?<1>[\da-fA-F]+))|(?:(?<1>[\da-fA-F]+)[hH]?)$", RegexOptions.Compiled); #endregion #region i/o public static readonly Regex InvalidPathChars; public static readonly Regex FileName = new Regex(@"[^\\/:;]*$", RegexOptions.Compiled); public static readonly Regex FileExtension = new Regex(@"\.[^\.]+$", RegexOptions.Compiled); #endregion } }