N
N
nixischev2014-03-24 19:08:10
Regular Expressions
nixischev, 2014-03-24 19:08:10

JS RegExp - how to limit the number of characters?

Good day!
There is a regular check by phone number:

/(?:8|\+7)? ?\(?(\d{3})\)? ?(\d{3})[ -]?(\d{2})[ -]?(\d{2})/

Tell me, please, how to make a limit on the number of digits (10 pieces maximum)? In this case, the remaining characters (spaces, hyphens, etc.) can be as many as you like.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Borisovich, 2014-07-08
@Alexufo

what for regular season on phones? immediately in the desired format, let them enter.
Awesome plugin:
www.compnot.ru/javascript/input-mask-sozdaem-masku...
plugins.jquery.com/mask

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question