V
V
vdvpie222015-12-11 11:41:30
JavaScript
vdvpie22, 2015-12-11 11:41:30

Please help with Regexp JavaScript for mobile?

I'm trying to check a mobile phone with this expression:
$("input#phone").val().match("(\+7)9[0-9]{9}")
But it skips any numbers. Incl. and with 8ki starting
What am I doing wrong?
It is necessary that the number be exactly +79888888888
where 8 is any number

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2015-12-11
@vdvpie22

Try to pass not a string but a regular expression:
$("input#phone").val().match(/(\+7)9[0-9]{9}/)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question