regex for a number code example Example 1: regular expression number from 1 to 100 ^[1-9][0-9]?$|^100$ Example 2: regex for numbers Regex regex = new Regex(@"^\d$");