quantity specifiers
utilizando llaves. A veces solo desea especificar el número más bajo de patrones sin límite superior.
Para especificar solo el número más bajo de patrones, mantenga el primer número seguido de una coma.
Por ejemplo, para hacer coincidir solo la cadena "hah"
con la letra a
aparece al menos 3
veces, su expresión regular sería /ha{3,}h/
.
let A4 = "haaaah";
let A2 = "haah";
let A100 = "h" + "a".repeat(100) + "h";
let multipleA = /ha{3,}h/;
multipleA.test(A4); // Returns true
multipleA.test(A2); // Returns false
multipleA.test(A100); // Returns true
haRegex
para que coincida con la palabra "Hazzah"
solo cuando tenga cuatro o más letras z
's.
"Hazzah"
testString: 'assert(!haRegex.test("Hazzah"), "Your regex should not match "Hazzah"
");'
- text: Su expresión regular no debe coincidir con "Hazzzah"
testString: 'assert(!haRegex.test("Hazzzah"), "Your regex should not match "Hazzzah"
");'
- text: Su expresión regular debe coincidir con "Hazzzzah"
testString: 'assert(haRegex.test("Hazzzzah"), "Your regex should match "Hazzzzah"
");'
- text: Su expresión regular debe coincidir con "Hazzzzzah"
testString: 'assert(haRegex.test("Hazzzzzah"), "Your regex should match "Hazzzzzah"
");'
- text: Su expresión regular debe coincidir con "Hazzzzzzah"
testString: 'assert(haRegex.test("Hazzzzzzah"), "Your regex should match "Hazzzzzzah"
");'
- text: Su expresión regular debe coincidir con "Hazzah"
con 30 z
\ 's en ella.
testString: 'assert(haRegex.test("Ha" + "z".repeat(30) + "ah"), "Your regex should match "Hazzah"
with 30 z
\"s in it.");'
```