Files
freeCodeCamp/curriculum/challenges/spanish/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.spanish.md
2018-10-08 13:34:43 -04:00

3.0 KiB

id, title, localeTitle, challengeType
id title localeTitle challengeType
587d7db6367417b2b2512b9a Match Characters that Occur Zero or More Times Caracteres de coincidencia que ocurren cero o más veces 1

Description

El último desafío usó el signo más + para buscar caracteres que aparecen una o más veces. También hay una opción que coincide con los caracteres que aparecen cero o más veces. El personaje para hacer esto es el asterisk o star : * .
let soccerWord = "gooooooooal!";
let gPhrase = "gut feeling";
let oPhrase = "over the moon";
let goRegex = /go*/;
soccerWord.match(goRegex); // Returns ["goooooooo"]
gPhrase.match(goRegex); // Returns ["g"]
oPhrase.match(goRegex); // Returns null

Instructions

Cree un regex chewieRegex que use el carácter * para que coincida con todos los caracteres "a" superiores e inferiores en chewieQuote . Su expresión regular no necesita indicadores y no debe coincidir con ninguna de las otras comillas.

Tests

tests:
  - text: Su expresión regular <code>chewieRegex</code> debe utilizar el <code>*</code> carácter a cero o más <code>a</code> personajes.
    testString: 'assert(/\*/.test(chewieRegex.source), "Your regex <code>chewieRegex</code> should use the <code>*</code> character to match zero or more <code>a</code> characters.");'
  - text: Tu regex <code>chewieRegex</code> debe coincidir con 16 caracteres.
    testString: 'assert(result[0].length === 16, "Your regex <code>chewieRegex</code> should match 16 characters.");'
  - text: Tu expresión regular debe coincidir con <code>&quot;Aaaaaaaaaaaaaaaa&quot;</code> .
    testString: 'assert(result[0] === "Aaaaaaaaaaaaaaaa", "Your regex should match <code>"Aaaaaaaaaaaaaaaa"</code>.");'
  - text: &#39;Tu expresión regular no debe coincidir con ningún carácter en <code>&quot;He made a fair move. Screaming about it can&#39;t help you.&quot;</code> &#39;
    testString: 'assert(!"He made a fair move. Screaming about it can\"t help you.".match(chewieRegex), "Your regex should not match any characters in <code>"He made a fair move. Screaming about it can&#39t help you."</code>");'
  - text: &quot;Tu expresión regular no debe coincidir con ningún carácter en <code>&quot;Let him have it. It&#39;s not wise to upset a Wookiee.&quot;</code> &#39;
    testString: 'assert(!"Let him have it. It\"s not wise to upset a Wookiee.".match(chewieRegex), "Your regex should not match any characters in <code>"Let him have it. It&#39s not wise to upset a Wookiee."</code>");'

Challenge Seed

let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /change/; // Change this line
let result = chewieQuote.match(chewieRegex);

Solution

// solution required