Using Regular Expressions to see if string validates as a numeric or number value

The following method will take in a string and return a bool value if it’s a valid number:

///         
/// Uses Regular expressions to see if we are a number        
///         
///         
///         
static bool IsNumeric(string inputString)
{

return System.Text.RegularExpressions.Regex.IsMatch(inputString, “^[0-9]+$”);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.