regexp for numbers only code example Example 1: regex pattern for positive numbers only ^[1-9]+[0-9]*$ Example 2: regex 10 numbers only @"^\d{10}$"