We can also specify a character range inside a character class by using a hyphen ( - ) between two characters. You just have to make sure that the left-hand side character of a range is lower in the ASCII table than the right-hand side character. We can match all the digits using the regex patterns, [0123456789], or a shorter [0-9].