Is Numeric via Regex - CSharp System.Text.RegularExpressions

CSharp examples for System.Text.RegularExpressions:Match Number

Description

Is Numeric via Regex

Demo Code


using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using System.Linq;
using System.ComponentModel;
using System.Collections.Generic;
using System;//from   w  w w .  j  a  va2  s . c om

public class Main{
        public static bool IsNumeric(string value)
        {
            const string pattern = @"^\d+$";
            return Regex.IsMatch(value, pattern);
        }
}

Related Tutorials