--- id: 587d7db4367417b2b2512b93 title: Find More Than the First Match challengeType: 1 videoUrl: '' localeTitle: Encuentra más que el primer partido --- ## Description
Hasta ahora, solo ha podido extraer o buscar un patrón una vez.
deje testStr = "Repetir, Repetir, Repetir";
vamos a nuestroRegex = / Repetir /;
testStr.match (ourRegex);
// Devoluciones ["Repetir"]
Para buscar o extraer un patrón más de una vez, puede usar la bandera g .
vamos a repeatRegex = / Repetir / g;
testStr.match (repeatRegex);
// Devuelve ["Repetir", "Repetir", "Repetir"]
## Instructions
Usando el regex starRegex , encuentra y extrae ambas palabras "Twinkle" de la cadena twinkleStar . Nota
Puedes tener múltiples banderas en tu expresión regular como /search/gi
## Tests
```yml tests: - text: Tu regex 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.");' ```
## Challenge Seed
```js let twinkleStar = "Twinkle, twinkle, little star"; let starRegex = /change/; // Change this line let result = twinkleStar; // Change this line ```
## Solution
```js // solution required ```