James123
James123

Reputation: 11652

Regex for certain numbers

I would like users to enter certain number (not other than those). How to do that with regex.

example:

123451,
456721,
783453

Users are allowed for above number to put them in regex?

Upvotes: 0

Views: 55

Answers (1)

Aaron
Aaron

Reputation: 24802

I don't know which language you are using but I doubt using regex would be a satisfying solution to this problem in any of them. You should instead check for inclusion in a set of expected input.

Anyway if you need to use regex, the following would do the trick :

^(123451|456721|783453)$

Upvotes: 2

Related Questions