deje testStr = "Repetir, Repetir, Repetir";Para buscar o extraer un patrón más de una vez, puede usar la bandera
vamos a nuestroRegex = / Repetir /;
testStr.match (ourRegex);
// Devoluciones ["Repetir"]
g . vamos a repeatRegex = / Repetir / g;
testStr.match (repeatRegex);
// Devuelve ["Repetir", "Repetir", "Repetir"]
starRegex , encuentra y extrae ambas palabras "Twinkle" de la cadena twinkleStar . Nota /search/gi starRegex debe usar la bandera global g
testString: 'assert(starRegex.flags.match(/g/).length == 1, "Your regex starRegex should use the global flag g");'
- text: Su regex starRegex debe usar el indicador de mayúsculas y minúsculas i
testString: 'assert(starRegex.flags.match(/i/).length == 1, "Your regex starRegex should use the case insensitive flag i");'
- text: Tu coincidencia debe coincidir con ambas apariciones de la palabra "Twinkle"
testString: 'assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join(), "Your match should match both occurrences of the word "Twinkle"");'
- text: El result tu partida debe tener dos elementos.
testString: 'assert(result.length == 2, "Your match result should have two elements in it.");'
```