Skip to content

Commit 39b2c77

Browse files
committed
traducción 09-04-a
caret arreglado typo typo 2 typo dollar
1 parent 8d36bcc commit 39b2c77

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
An empty string is the only match: it starts and immediately finishes.
1+
Una cadena vacía es la única coincidencia: comienza y termina inmediatamente.
22

3-
The task once again demonstrates that anchors are not characters, but tests.
3+
Esta tarea demuestra una vez más que los anclajes no son caracteres, sino pruebas.
44

5-
The string is empty `""`. The engine first matches the `pattern:^` (input start), yes it's there, and then immediately the end `pattern:$`, it's here too. So there's a match.
5+
La cadena está vacía `""`. El motor primero coincide con `pattern:^` (inicio de entrada), sí, está allí, y luego inmediatamente el final `pattern:$`, también está. Entonces hay una coincidencia.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Regexp ^$
22

3-
Which string matches the pattern `pattern:^$`?
3+
¿Qué cadena coincide con el patrón `pattern:^$`?

Diff for: 9-regular-expressions/04-regexp-anchors/article.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
# Anchors: string start ^ and end $
1+
# Anclas: inicio ^ y final $ de cadena
22

3-
The caret `pattern:^` and dollar `pattern:$` characters have special meaning in a regexp. They are called "anchors".
3+
Los patrones caret (del latín carece) `pattern:^` y dólar `pattern:$` tienen un significado especial en una expresión regular. Se llaman "anclas".
44

5-
The caret `pattern:^` matches at the beginning of the text, and the dollar `pattern:$` -- at the end.
5+
El patrón caret `pattern:^` coincide con el principio del texto y dólar `pattern:$` con el final.
66

7-
For instance, let's test if the text starts with `Mary`:
7+
Por ejemplo, probemos si el texto comienza con `Mary`:
88

99
```js run
10-
let str1 = "Mary had a little lamb";
10+
let str1 = "Mary tenía un corderito";
1111
alert( /^Mary/.test(str1) ); // true
1212
```
1313

14-
The pattern `pattern:^Mary` means: "string start and then Mary".
14+
El patrón `pattern:^Mary` significa: "inicio de cadena y luego Mary".
1515

16-
Similar to this, we can test if the string ends with `snow` using `pattern:snow$`:
16+
Similar a esto, podemos probar si la cadena termina con `nieve` usando `pattern:nieve$`:
1717

1818
```js run
19-
let str1 = "it's fleece was white as snow";
20-
alert( /snow$/.test(str1) ); // true
19+
let str1 = "su vellón era blanco como la nieve";
20+
alert( /nieve$/.test(str1) ); // true
2121
```
2222

23-
In these particular cases we could use string methods `startsWith/endsWith` instead. Regular expressions should be used for more complex tests.
23+
En estos casos particulares, en su lugar podríamos usar métodos de cadena `beginWith/endsWith`. Las expresiones regulares deben usarse para pruebas más complejas.
2424

25-
## Testing for a full match
25+
## Prueba para una coincidencia completa
2626

27-
Both anchors together `pattern:^...$` are often used to test whether or not a string fully matches the pattern. For instance, to check if the user input is in the right format.
27+
Ambos anclajes `pattern:^...$` se usan juntos a menudo para probar si una cadena coincide completamente con el patrón. Por ejemplo, para verificar si la entrada del usuario está en el formato correcto.
2828

29-
Let's check whether or not a string is a time in `12:34` format. That is: two digits, then a colon, and then another two digits.
29+
Verifiquemos si una cadena esta o no en formato de hora `12:34`. Es decir: dos dígitos, luego dos puntos y luego otros dos dígitos.
3030

31-
In regular expressions language that's `pattern:\d\d:\d\d`:
31+
En el idioma de las expresiones regulares eso es `pattern:\d\d:\d\d`:
3232

3333
```js run
3434
let goodInput = "12:34";
@@ -39,14 +39,14 @@ alert( regexp.test(goodInput) ); // true
3939
alert( regexp.test(badInput) ); // false
4040
```
4141

42-
Here the match for `pattern:\d\d:\d\d` must start exactly after the beginning of the text `pattern:^`, and the end `pattern:$` must immediately follow.
42+
La coincidencia para `pattern:\d\d:\d\d` debe comenzar exactamente después del inicio de texto`pattern:^`, y seguido inmediatamente, el final `pattern:$`.
4343

44-
The whole string must be exactly in this format. If there's any deviation or an extra character, the result is `false`.
44+
Toda la cadena debe estar exactamente en este formato. Si hay alguna desviación o un carácter adicional, el resultado es `falso`.
4545

46-
Anchors behave differently if flag `pattern:m` is present. We'll see that in the next article.
46+
Las anclas se comportan de manera diferente si la bandera `pattern:m` está presente. Lo veremos en el próximo artículo.
4747

48-
```smart header="Anchors have \"zero width\""
49-
Anchors `pattern:^` and `pattern:$` are tests. They have zero width.
48+
```smart header="Las anclas tienen \"ancho cero\""
49+
Las anclas `pattern:^` y `pattern:$` son pruebas. Ellas tienen ancho cero.
5050
51-
In other words, they do not match a character, but rather force the regexp engine to check the condition (text start/end).
51+
En otras palabras, no coinciden con un carácter, sino que obligan al motor regexp a verificar la condición (inicio/fin de texto).
5252
```

0 commit comments

Comments
 (0)