in regex how to specify number of occurrence code example
Example 1: numbered occurences in regex
/^[a-z]{0,10}$/
{3} exactly 3
{6,} at least 6
{2,5} 2 to 5
Example 2: javascript regex Zero or one occurrence
// javascript regex Zero or one occurrence
let neighbor = /neighbou?r/;
console.log(neighbor.test("neighbour")); // true
console.log(neighbor.test("neighbor")); // true