This struct provides a public library of regular expressions which are specific to numbers and have been tested for common conditions, with each Expression there is a IsXX method to test is the expression is valid or not

Namespace:  CA.Common.Text.RegexPatterns
Assembly:  CA.Common (in CA.Common.dll) Version: 1.0.0.0 (1.0.0.0)

Remarks

CopyFull Source Code for the RegexPattern_Number struct
//Source code from the Code Associate C# code library, Full documentation and latest updates can be found
//@ http://www.codeassociate.com/caapi/
using System;
using System.Text.RegularExpressions;

namespace CA.Common.Text.RegexPatterns
{
    public struct RegexPattern_Number
    {
        public const string PositiveWholeNumber = "^\\d+$";

        public static bool IsPositiveWholeNumber(string input)
        {
            return (Regex.IsMatch(input, PositiveWholeNumber));
        }

        public const string WholeNumber = "^\\-?\\d+$";

        public static bool IsWholeNumber(string input)
        {
            return (Regex.IsMatch(input, WholeNumber));
        }
    }
}

See Also