chore(i8n,curriculum): processed translations (#41575)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7dba367417b2b2512ba8
|
||||
title: Check for All or None
|
||||
title: Comprueba todos o ninguno
|
||||
challengeType: 1
|
||||
forumTopicId: 301338
|
||||
dashedName: check-for-all-or-none
|
||||
@ -8,48 +8,50 @@ dashedName: check-for-all-or-none
|
||||
|
||||
# --description--
|
||||
|
||||
Sometimes the patterns you want to search for may have parts of it that may or may not exist. However, it may be important to check for them nonetheless.
|
||||
A veces los patrones que quieres buscar pueden tener partes que pueden o no existir. Sin embargo, podría ser importante buscarlos de todos maneras.
|
||||
|
||||
You can specify the possible existence of an element with a question mark, `?`. This checks for zero or one of the preceding element. You can think of this symbol as saying the previous element is optional.
|
||||
Puedes especificar la posible existencia de un elemento con un signo de interrogación, `?`. Esto comprueba cero o uno de los elementos precedentes. Puedes pensar que este símbolo dice que el elemento anterior es opcional.
|
||||
|
||||
For example, there are slight differences in American and British English and you can use the question mark to match both spellings.
|
||||
Por ejemplo, hay ligeras diferencias en inglés americano y británico y puedes usar el signo de interrogación para coincidir con ambas ortografías.
|
||||
|
||||
```js
|
||||
let american = "color";
|
||||
let british = "colour";
|
||||
let rainbowRegex= /colou?r/;
|
||||
rainbowRegex.test(american); // Returns true
|
||||
rainbowRegex.test(british); // Returns true
|
||||
rainbowRegex.test(american);
|
||||
rainbowRegex.test(british);
|
||||
```
|
||||
|
||||
Ambos usos del método `test` devolverán `true`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Change the regex `favRegex` to match both the American English (favorite) and the British English (favourite) version of the word.
|
||||
Cambia la expresión regular `favRegex` para que coincida tanto la versión del inglés americano (`favorite`) como la versión del inglés británico de la palabra (`favourite`).
|
||||
|
||||
# --hints--
|
||||
|
||||
Your regex should use the optional symbol, `?`.
|
||||
Tu expresión regular debe usar el símbolo opcional, `?`.
|
||||
|
||||
```js
|
||||
favRegex.lastIndex = 0;
|
||||
assert(favRegex.source.match(/\?/).length > 0);
|
||||
```
|
||||
|
||||
Your regex should match `"favorite"`
|
||||
Tu expresión regular debe coincidir con la cadena `favorite`
|
||||
|
||||
```js
|
||||
favRegex.lastIndex = 0;
|
||||
assert(favRegex.test('favorite'));
|
||||
```
|
||||
|
||||
Your regex should match `"favourite"`
|
||||
Tu expresión regular debe coincidir con la cadena `favourite`
|
||||
|
||||
```js
|
||||
favRegex.lastIndex = 0;
|
||||
assert(favRegex.test('favourite'));
|
||||
```
|
||||
|
||||
Your regex should not match `"fav"`
|
||||
Tu expresión regular no debe coincidir con la cadena `fav`
|
||||
|
||||
```js
|
||||
favRegex.lastIndex = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5c3dda8b4d8df89bea71600f
|
||||
title: Check For Mixed Grouping of Characters
|
||||
title: Comprueba agrupaciones mixtas de caracteres
|
||||
challengeType: 1
|
||||
forumTopicId: 301339
|
||||
dashedName: check-for-mixed-grouping-of-characters
|
||||
@ -8,62 +8,63 @@ dashedName: check-for-mixed-grouping-of-characters
|
||||
|
||||
# --description--
|
||||
|
||||
Sometimes we want to check for groups of characters using a Regular Expression and to achieve that we use parentheses `()`.
|
||||
A veces queremos comprobar grupos de caracteres utilizando una expresión regular y para conseguirlo usamos paréntesis `()`.
|
||||
|
||||
If you want to find either `Penguin` or `Pumpkin` in a string, you can use the following Regular Expression: `/P(engu|umpk)in/g`
|
||||
Si deseas encontrar `Penguin` o `Pumpkin` en una cadena, puedes usar la siguiente expresión regular: `/P(engu|umpk)in/g`
|
||||
|
||||
Then check whether the desired string groups are in the test string by using the `test()` method.
|
||||
Luego, comprueba si los grupos de cadena deseados están en la cadena de prueba usando el método `test()`.
|
||||
|
||||
```js
|
||||
let testStr = "Pumpkin";
|
||||
let testRegex = /P(engu|umpk)in/;
|
||||
testRegex.test(testStr);
|
||||
// Returns true
|
||||
```
|
||||
|
||||
El método `test` aquí devolverá `true`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Fix the regex so that it checks for the names of `Franklin Roosevelt` or `Eleanor Roosevelt` in a case sensitive manner and it should make concessions for middle names.
|
||||
Corrige la expresión regular para que compruebe los nombres de `Franklin Roosevelt` o `Eleanor Roosevelt` de una manera sensible a mayúsculas y minúsculas y haciendo concesiones para los segundos nombres.
|
||||
|
||||
Then fix the code so that the regex that you have created is checked against `myString` and either `true` or `false` is returned depending on whether the regex matches.
|
||||
Luego, corrige el código para que la expresión regular que has creado se compruebe con `myString` y devuelva `true` o `false` dependiendo de si la expresión regular coincide.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your regex `myRegex` should return `true` for the string `Franklin D. Roosevelt`
|
||||
Tu expresión regular `myRegex` debe devolver `true` para la cadena `Franklin D. Roosevelt`
|
||||
|
||||
```js
|
||||
myRegex.lastIndex = 0;
|
||||
assert(myRegex.test('Franklin D. Roosevelt'));
|
||||
```
|
||||
|
||||
Your regex `myRegex` should return `true` for the string `Eleanor Roosevelt`
|
||||
Tu expresión regular `myRegex` debe devolver `true` para la cadena `Eleanor Roosevelt`
|
||||
|
||||
```js
|
||||
myRegex.lastIndex = 0;
|
||||
assert(myRegex.test('Eleanor Roosevelt'));
|
||||
```
|
||||
|
||||
Your regex `myRegex` should return `false` for the string `Franklin Rosevelt`
|
||||
Tu expresión regular `myRegex` debe devolver `false` para la cadena `Franklin Rosevelt`
|
||||
|
||||
```js
|
||||
myRegex.lastIndex = 0;
|
||||
assert(!myRegex.test('Franklin Rosevelt'));
|
||||
```
|
||||
|
||||
Your regex `myRegex` should return `false` for the string `Frank Roosevelt`
|
||||
Tu expresión regular `myRegex` debe devolver `false` para la cadena `Frank Roosevelt`
|
||||
|
||||
```js
|
||||
myRegex.lastIndex = 0;
|
||||
assert(!myRegex.test('Frank Roosevelt'));
|
||||
```
|
||||
|
||||
You should use `.test()` to test the regex.
|
||||
Debes usar `.test()` para probar la expresión regular.
|
||||
|
||||
```js
|
||||
assert(code.match(/myRegex.test\(\s*myString\s*\)/));
|
||||
```
|
||||
|
||||
Your result should return `true`.
|
||||
Tu resultado debe devolver `true`.
|
||||
|
||||
```js
|
||||
assert(result === true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7db4367417b2b2512b92
|
||||
title: Extract Matches
|
||||
title: Extrae coincidencias
|
||||
challengeType: 1
|
||||
forumTopicId: 301340
|
||||
dashedName: extract-matches
|
||||
@ -8,22 +8,22 @@ dashedName: extract-matches
|
||||
|
||||
# --description--
|
||||
|
||||
So far, you have only been checking if a pattern exists or not within a string. You can also extract the actual matches you found with the `.match()` method.
|
||||
Hasta ahora, sólo has estado comprobando si un patrón existe o no dentro de una cadena. También puedes extraer las coincidencias encontradas con el método `.match()`.
|
||||
|
||||
To use the `.match()` method, apply the method on a string and pass in the regex inside the parentheses.
|
||||
Para utilizar el método `.match()`, aplica el método a una cadena y pasa la expresión regular dentro de los paréntesis.
|
||||
|
||||
Here's an example:
|
||||
Este es un ejemplo:
|
||||
|
||||
```js
|
||||
"Hello, World!".match(/Hello/);
|
||||
// Returns ["Hello"]
|
||||
let ourStr = "Regular expressions";
|
||||
let ourRegex = /expressions/;
|
||||
ourStr.match(ourRegex);
|
||||
// Returns ["expressions"]
|
||||
```
|
||||
|
||||
Note that the `.match` syntax is the "opposite" of the `.test` method you have been using thus far:
|
||||
Aquí el primer `match` devolverá `["Hello"]` y el segundo devolverá `["expressions"]`.
|
||||
|
||||
Ten en cuenta que la sintaxis `.match` es lo "opuesto" al método `.test` que has estado utilizando hasta ahora:
|
||||
|
||||
```js
|
||||
'string'.match(/regex/);
|
||||
@ -32,23 +32,23 @@ Note that the `.match` syntax is the "opposite" of the `.test` method you have b
|
||||
|
||||
# --instructions--
|
||||
|
||||
Apply the `.match()` method to extract the word `coding`.
|
||||
Aplica el método `.match()` para extraer la cadena `coding`.
|
||||
|
||||
# --hints--
|
||||
|
||||
The `result` should have the word `coding`
|
||||
`result` debe contener la cadena `coding`
|
||||
|
||||
```js
|
||||
assert(result.join() === 'coding');
|
||||
```
|
||||
|
||||
Your regex `codingRegex` should search for `coding`
|
||||
Tu expresión regular `codingRegex` debe buscar la cadena `coding`
|
||||
|
||||
```js
|
||||
assert(codingRegex.source === 'coding');
|
||||
```
|
||||
|
||||
You should use the `.match()` method.
|
||||
Debes utilizar el método `.match()`.
|
||||
|
||||
```js
|
||||
assert(code.match(/\.match\(.*\)/));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7db6367417b2b2512b9b
|
||||
title: Find Characters with Lazy Matching
|
||||
title: Encuentra caracteres con una coincidencia perezosa
|
||||
challengeType: 1
|
||||
forumTopicId: 301341
|
||||
dashedName: find-characters-with-lazy-matching
|
||||
@ -8,36 +8,35 @@ dashedName: find-characters-with-lazy-matching
|
||||
|
||||
# --description--
|
||||
|
||||
In regular expressions, a <dfn>greedy</dfn> match finds the longest possible part of a string that fits the regex pattern and returns it as a match. The alternative is called a <dfn>lazy</dfn> match, which finds the smallest possible part of the string that satisfies the regex pattern.
|
||||
En las expresiones regulares, una coincidencia <dfn>codiciosa</dfn> encuentra la parte más larga posible de una cadena que se ajusta al patrón de la expresión regular y la devuelve como una coincidencia. La alternativa es llamada coincidencia <dfn>perezosa</dfn>, la cual encuentra la parte más pequeña posible de la cadena que satisface el patrón de la expresión regular.
|
||||
|
||||
You can apply the regex `/t[a-z]*i/` to the string `"titanic"`. This regex is basically a pattern that starts with `t`, ends with `i`, and has some letters in between.
|
||||
Puedes aplicar la expresión regular `/t[a-z]*i/` a la cadena `"titanic"`. Esta expresión regular es básicamente un patrón que comienza con `t`, termina con `i`, y tiene algunas letras intermedias.
|
||||
|
||||
Regular expressions are by default greedy, so the match would return `["titani"]`. It finds the largest sub-string possible to fit the pattern.
|
||||
Las expresiones regulares son por defecto codiciosas, por lo que la coincidencia devolvería `["titani"]`. Encuentra la sub-cadena más grande posible que se ajusta al patrón.
|
||||
|
||||
However, you can use the `?` character to change it to lazy matching. `"titanic"` matched against the adjusted regex of `/t[a-z]*?i/` returns `["ti"]`.
|
||||
Sin embargo, puedes usar el carácter `?` para cambiarla a una coincidencia perezosa. `"titanic"` al coincidir con la expresión regular ajustada de `/t[a-z]*?i/` devuelve `["ti"]`.
|
||||
|
||||
**Note**
|
||||
Parsing HTML with regular expressions should be avoided, but pattern matching an HTML string with regular expressions is completely fine.
|
||||
**Nota:** Se debe evitar analizar HTML con expresiones regulares, pero coincidir patrones con una cadena HTML utilizando expresiones regulares está completamente bien.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Fix the regex `/<.*>/` to return the HTML tag `<h1>` and not the text `"<h1>Winter is coming</h1>"`. Remember the wildcard `.` in a regular expression matches any character.
|
||||
Corrige la expresión regular `/<.*>/` para que devuelva la etiqueta HTML `<h1>` y no el texto `"<h1>Winter is coming</h1>"`. Recuerda que el comodín `.` en una expresión regular coincide con cualquier carácter.
|
||||
|
||||
# --hints--
|
||||
|
||||
The `result` variable should be an array with `<h1>` in it
|
||||
La variable `result` debe ser un arreglo con `<h1>` en él
|
||||
|
||||
```js
|
||||
assert(result[0] == '<h1>');
|
||||
```
|
||||
|
||||
`myRegex` should use lazy matching
|
||||
`myRegex` debe usar una coincidencia perezosa
|
||||
|
||||
```js
|
||||
assert(/\?/g.test(myRegex));
|
||||
```
|
||||
|
||||
`myRegex` should not include the string 'h1'
|
||||
`myRegex` no debe incluir la cadena `h1`
|
||||
|
||||
```js
|
||||
assert(!myRegex.source.match('h1'));
|
||||
|
Reference in New Issue
Block a user