Files
freeCodeCamp/curriculum/challenges/spanish/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.spanish.md
2018-10-08 13:34:43 -04:00

3.0 KiB

id, title, localeTitle, challengeType
id title localeTitle challengeType
587d7db9367417b2b2512ba5 Specify Upper and Lower Number of Matches Especifique el número superior e inferior de coincidencias 1

Description

Recuerde que usa el signo más + para buscar uno o más caracteres y el asterisco * para buscar cero o más caracteres. Estos son convenientes, pero a veces usted quiere hacer coincidir un cierto rango de patrones. Puede especificar el número inferior y superior de patrones con quantity specifiers . Los especificadores de cantidad se utilizan con llaves ( { y } ). Pones dos números entre las llaves: para el número inferior y superior de patrones. Por ejemplo, para hacer coincidir solo la letra a aparece entre 3 y 5 veces en la cadena "ah" , su expresión regular sería /a{3,5}h/ .
let A4 = "aaaah";
let A2 = "aah";
let multipleA = /a{3,5}h/;
multipleA.test(A4); // Returns true
multipleA.test(A2); // Returns false

Instructions

Cambie el regex ohRegex para que coincida solo con 3 a 6 letras h en la palabra "Oh no" .

Tests

tests:
  - text: Su expresión regular debe utilizar llaves.
    testString: 'assert(ohRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
  - text: Su expresión regular no debe coincidir con <code clase = "notranslate"> "Ohh no" </code>
    testString: 'assert(!ohRegex.test("Ohh no"), "Your regex should not match <code>"Ohh no"</code>");'
  - text: Su expresión regular debe coincidir con <code clase = "notranslate"> "Ohhh no" </code>
    testString: 'assert(ohRegex.test("Ohhh no"), "Your regex should match <code>"Ohhh no"</code>");'
  - text: Su expresión regular debe coincidir con <code clase = "notranslate"> "Ohhhh no" </code>
    testString: 'assert(ohRegex.test("Ohhhh no"), "Your regex should match <code>"Ohhhh no"</code>");'
  - text: Su expresión regular debe coincidir con <code clase = "notranslate"> "Ohhhhh no" </code>
    testString: 'assert(ohRegex.test("Ohhhhh no"), "Your regex should match <code>"Ohhhhh no"</code>");'
  - text: Su expresión regular debe coincidir con <code clase = "notranslate"> "Ohhhhhh no" </code>
    testString: 'assert(ohRegex.test("Ohhhhhh no"), "Your regex should match <code>"Ohhhhhh no"</code>");'
  - text: Su expresión regular no debe coincidir con <code clase = "notranslate"> "Ohhhhhhh no" </code>
    testString: 'assert(!ohRegex.test("Ohhhhhhh no"), "Your regex should not match <code>"Ohhhhhhh no"</code>");'

Challenge Seed

let ohStr = "Ohhh no";
let ohRegex = /change/; // Change this line
let result = ohRegex.test(ohStr);

Solution

// solution required