user2417766
user2417766

Reputation: 3

combining 2 regex into one

I want a regex that will: - check the first 2 characters equal 04 - check the length is 10 and contains numbers

I have this, and tried numberous things but couldn't find how to combine the 2 in one using a 'and' or if I have the first check even right...

pattern = "(04{1,1})/([0-9]{10,10})"

Upvotes: 0

Views: 74

Answers (1)

FUD
FUD

Reputation: 5184

You can use the following

/^04[0-9]{8}$/

Upvotes: 7

Related Questions