A
A
Aleksandr Yurchenko2021-07-12 20:34:26
Regular Expressions
Aleksandr Yurchenko, 2021-07-12 20:34:26

How to get a specific length of digits (5 or 10) with a regular expression?

How can I write a regular expression that checks the following condition: " only digits of 5 or 10 characters are allowed "?

The option [0-9]{5}|[0-9]{10}does not fit, and I can not think of an alternative.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2021-07-12
@yaleksandr89

^(\d{5}){1,2}$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question