Regular expression for number with length of 4, 5 or 6 April 26, 2023 by Tarik Try this: ^[0-9]{4,6}$ {4,6} = between 4 and 6 characters, inclusive.