lundi 30 novembre 2020

Regex testing for 10 non-consecutive numbers

I need to test true or false for 10 non-consecutive numbers.

I have already tried:

function numberCheck(str) {
  let hasTenDigits = /\d{10}/.test(str);
  return hasTenDigits; 
}
console.log(numberCheck("111-111-1111"))

But it returns false since my 10 numbers are not consecutive. How can I go through this little issue?

Aucun commentaire:

Enregistrer un commentaire