regular expression for only numbers in c# code example Example: regex for numbers Regex regex = new Regex(@"^\d$");