diff --git a/9-regular-expressions/14-regexp-lookahead-lookbehind/1-find-non-negative-integers/solution.md b/9-regular-expressions/14-regexp-lookahead-lookbehind/1-find-non-negative-integers/solution.md index ebc12689d..0779974f0 100644 --- a/9-regular-expressions/14-regexp-lookahead-lookbehind/1-find-non-negative-integers/solution.md +++ b/9-regular-expressions/14-regexp-lookahead-lookbehind/1-find-non-negative-integers/solution.md @@ -1,9 +1,9 @@ -The regexp for an integer number is `pattern:\d+`. +La expresión regular para un número entero es `pattern:\d+`. -We can exclude negatives by prepending it with the negative lookbehind: `pattern:(?` tag, we must first find it. We can use the regular expression pattern `pattern:` for that. +Para insertar algo después de la etiqueta ``, primero debemos encontrarla. Para ello podemos usar la expresión regular `pattern:`. -In this task we don't need to modify the `` tag. We only need to add the text after it. +En esta tarea no debemos modificar la etiqueta ``. Solamente agregar texto después de ella. -Here's how we can do it: +Veamos cómo podemos hacerlo: ```js run let str = '......'; @@ -11,9 +11,9 @@ str = str.replace(//, '$&

Hello

'); alert(str); // ...

Hello

... ``` -In the replacement string `$&` means the match itself, that is, the part of the source text that corresponds to `pattern:`. It gets replaced by itself plus `

Hello

`. +En el string de reemplazo, `$&` significa la coincidencia misma, la parte del texto original que corresponde a `pattern:`. Es reemplazada por sí misma más `

Hello

`. -An alternative is to use lookbehind: +Una alternativa es el uso de "lookbehind": ```js run let str = '......'; @@ -22,15 +22,15 @@ str = str.replace(/(?<=)/, `

Hello

`); alert(str); // ...

Hello

... ``` -As you can see, there's only lookbehind part in this regexp. +Como puedes ver, solo está presente la parte "lookbehind" en esta expresión regular. -It works like this: -- At every position in the text. -- Check if it's preceeded by `pattern:`. -- If it's so then we have the match. +Esto funciona así: +- En cada posición en el texto. +- Chequea si está precedida por `pattern:`. +- Si es así, tenemos una coincidencia. -The tag `pattern:` won't be returned. The result of this regexp is literally an empty string, but it matches only at positions preceeded by `pattern:`. +La etiqueta `pattern:` no será devuelta. El resultado de esta expresión regular es un string vacío, pero coincide solo en las posiciones precedidas por `pattern:`. -So it replaces the "empty line", preceeded by `pattern:`, with `

Hello

`. That's the insertion after ``. +Entonces reemplaza la "linea vacía", precedida por `pattern:`, con `

Hello

`. Esto es, la inserción después de ``. -P.S. Regexp flags, such as `pattern:s` and `pattern:i` can also be useful: `pattern://si`. The `pattern:s` flag makes the dot `pattern:.` match a newline character, and `pattern:i` flag makes `pattern:` also match `match:` case-insensitively. +P.S. Los indicadores de Regexp tales como `pattern:s` y `pattern:i` también nos pueden ser útiles: `pattern://si`. El indicador `pattern:s` hace que que el punto `pattern:.` coincida también con el carácter de salto de línea, y el indicador `pattern:i` hace que `pattern:` también acepte coincidencias `match:` en mayúsculas y minúsculas. diff --git a/9-regular-expressions/14-regexp-lookahead-lookbehind/2-insert-after-head/task.md b/9-regular-expressions/14-regexp-lookahead-lookbehind/2-insert-after-head/task.md index be1a259f6..e442c36f8 100644 --- a/9-regular-expressions/14-regexp-lookahead-lookbehind/2-insert-after-head/task.md +++ b/9-regular-expressions/14-regexp-lookahead-lookbehind/2-insert-after-head/task.md @@ -1,13 +1,13 @@ -# Insert After Head +# Insertar después de la cabecera -We have a string with an HTML Document. +Tenemos un string con un documento HTML. -Write a regular expression that inserts `

Hello

` immediately after `` tag. The tag may have attributes. +Escribe una expresión regular que inserte `

Hello

` inmediatamente después de la etiqueta ``. La etiqueta puede tener atributos. -For instance: +Por ejemplo: ```js -let regexp = /your regular expression/; +let regexp = /tu expresión regular/; let str = ` @@ -20,7 +20,7 @@ let str = ` str = str.replace(regexp, `

Hello

`); ``` -After that the value of `str` should be: +Después de esto el valor de `str` debe ser: ```html

Hello

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy