const number = '731231';
const myRegex = /[0-6]/;
console.log(myRegex.test(number));
Could someone provide some insight into this code snippet?
In my opinion, the regular expression [0-6] should only match numbers between 0 and 6. However, in the example provided, a large value like 731231 is also considered to be true.