Skip to content

Commit 058f78f

Browse files
committed
Update 9-regular-expressions\10-regexp-greedy-and-lazy\tasks
1 parent e7ea680 commit 058f78f

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
The result is: `match:123 4`.
2+
Il risultato è: `match:123 4`.
33

4-
First the lazy `pattern:\d+?` tries to take as little digits as it can, but it has to reach the space, so it takes `match:123`.
4+
Inizialmente il quantificatore lazy `pattern:\d+?` prova a prendere il minor numero di cifre, ma deve raggiungere lo spazio, perciò include `match:123`.
55

6-
Then the second `\d+?` takes only one digit, because that's enough.
6+
Il secondo `\d+?` prende una cifra soltanto perché è sufficiente.

9-regular-expressions/10-regexp-greedy-and-lazy/1-lazy-greedy/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# A match for /d+? d+?/
1+
# Individuate la corrispondenza per /d+? d+?/
22

3-
What's the match here?
3+
Quale è la corrispondenza in questo caso?
44

55
```js
66
alert( "123 456".match(/\d+? \d+?/g) ); // ?

9-regular-expressions/10-regexp-greedy-and-lazy/3-find-html-comments/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
We need to find the beginning of the comment `match:<!--`, then everything till the end of `match:-->`.
1+
Abbiamo bisogno di trovare l'inizio del commento `match:<!--`, e dopo tutto quello che c'è fino a `match:-->`.
22

3-
An acceptable variant is `pattern:<!--.*?-->` -- the lazy quantifier makes the dot stop right before `match:-->`. We also need to add flag `pattern:s` for the dot to include newlines.
3+
Una variante accettabile è `pattern:<!--.*?-->`, il quantificatore lazy fa sì che la ricerca si fermi prima di `match:-->`. Dobbiamo, inoltre, aggiungere il flag `pattern:s` in modo che il punto includa gli a capo.
44

5-
Otherwise multiline comments won't be found:
5+
In caso contrario i commenti multilinea non verranno trovati:
66

77
```js run
88
let regexp = /<!--.*?-->/gs;

9-regular-expressions/10-regexp-greedy-and-lazy/3-find-html-comments/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Find HTML comments
1+
# Trovate i commenti HTML
22

3-
Find all HTML comments in the text:
3+
Trovate tutti i commenti HTML nel testo:
44

55
```js
66
let regexp = /your regexp/g;
77

88
let str = `... <!-- My -- comment
9-
test --> .. <!----> ..
9+
test --> .. <!----> ..
1010
`;
1111

1212
alert( str.match(regexp) ); // '<!-- My -- comment \n test -->', '<!---->'

0 commit comments

Comments
 (0)