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/
. sea A4 = "haaaah";
sea A2 = "haah";
deje A100 = "h" + "a" .repeat (100) + "h";
deja multipleA = / ha {3,} h /;
prueba múltiple (A4); // Devuelve true
prueba múltiple (A2); // Devuelve falso
prueba múltiple (A100); // Devuelve 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: Tu expresión regular no debe coincidir con "Hazzzah"
testString: 'assert(!haRegex.test("Hazzzah"), "Your regex should not match "Hazzzah"
");'
- text: Tu expresión regular debe coincidir con "Hazzzzah"
testString: 'assert(haRegex.test("Hazzzzah"), "Your regex should match "Hazzzzah"
");'
- text: Tu expresión regular debe coincidir con "Hazzzzzah"
testString: 'assert(haRegex.test("Hazzzzzah"), "Your regex should match "Hazzzzzah"
");'
- text: Tu expresión regular debe coincidir con "Hazzzzzzah"
testString: 'assert(haRegex.test("Hazzzzzzah"), "Your regex should match "Hazzzzzzah"
");'
- text: 'Tu 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.");'
```