CSharp examples for System.Text.RegularExpressions:Match Number
Checks if the string contains numbers via Regex
using System.Text.RegularExpressions; using System.Text; using System.Globalization; using System.Collections.Generic; using System;/*from w w w . ja v a2 s . c om*/ public class Main{ //Checks if the string contains numbers //hello -> False //h3llo -> True public static bool HasNumbers(string input) { return Regex.IsMatch(input, "\\d+"); } }