regexp only numbers code example Example 1: regex 10 numbers only @"^\d{10}$" Example 2: regex for numbers Regex regex = new Regex(@"^\d$");