-
Notifications
You must be signed in to change notification settings - Fork 59
Capturing groups #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
longo-andrea
merged 12 commits into
javascript-tutorial:master
from
marcellosurdi:article/regexp-groups
May 15, 2021
Merged
Capturing groups #320
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
944cf81
Starting translation 9-regular-expressions\11-regexp-groups\article
marcellosurdi 9cf483d
Update 9-regular-expressions\11-regexp-groups\article
marcellosurdi f5f458d
Update 9-regular-expressions\11-regexp-groups\article
marcellosurdi f849660
9-regular-expressions\11-regexp-groups\article
marcellosurdi e01abee
9-regular-expressions\11-regexp-groups\article
marcellosurdi 3ab89f4
Merge branch 'article/regexp-groups' of https://github.com/marcellosu…
marcellosurdi 005e425
Update 9-regular-expressions\11-regexp-groups\article
marcellosurdi 64a92ec
Update 9-regular-expressions\11-regexp-groups\article
marcellosurdi 2136679
Review 9-regular-expressions\11-regexp-groups\article
marcellosurdi 973cbbe
Update 9-regular-expressions\11-regexp-groups\01-test-mac\tasks
marcellosurdi da93e6e
Update and review 9-regular-expressions\11-regexp-groups\tasks
marcellosurdi b008713
Apply suggestions from code review
marcellosurdi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 8 additions & 8 deletions
16
9-regular-expressions/11-regexp-groups/01-test-mac/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| A two-digit hex number is `pattern:[0-9a-f]{2}` (assuming the flag `pattern:i` is set). | ||
| Un numero esadecimale a due cifre è `pattern:[0-9a-f]{2}` (dando per scontato che il flag `pattern:i` sia presente). | ||
|
|
||
| We need that number `NN`, and then `:NN` repeated 5 times (more numbers); | ||
| Dobbiamo trovare quel numero `NN`, seguito da `:NN` ripetuto 5 volte. | ||
|
|
||
| The regexp is: `pattern:[0-9a-f]{2}(:[0-9a-f]{2}){5}` | ||
| L'espressione regolare è: `pattern:[0-9a-f]{2}(:[0-9a-f]{2}){5}` | ||
|
|
||
| Now let's show that the match should capture all the text: start at the beginning and end at the end. That's done by wrapping the pattern in `pattern:^...$`. | ||
| Osserviamo, a questo punto, che la corrispondenza dovrebbe catturare tutto il testo: dall'inizio alla fine. A questo scopo racchiudiamo il pattern all'interno di `pattern:^...$`. | ||
|
|
||
| Finally: | ||
| Quindi: | ||
|
|
||
| ```js run | ||
| let regexp = /^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}$/i; | ||
|
|
||
| alert( regexp.test('01:32:54:67:89:AB') ); // true | ||
|
|
||
| alert( regexp.test('0132546789AB') ); // false (no colons) | ||
| alert( regexp.test('0132546789AB') ); // false (non ci sono i due punti) | ||
|
|
||
| alert( regexp.test('01:32:54:67:89') ); // false (5 numbers, need 6) | ||
| alert( regexp.test('01:32:54:67:89') ); // false (5 numeri invece di 6) | ||
|
|
||
| alert( regexp.test('01:32:54:67:89:ZZ') ) // false (ZZ in the end) | ||
| alert( regexp.test('01:32:54:67:89:ZZ') ) // false (ZZ alla fine) | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
9-regular-expressions/11-regexp-groups/03-find-decimal-numbers/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
9-regular-expressions/11-regexp-groups/03-find-decimal-numbers/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 22 additions & 22 deletions
44
9-regular-expressions/11-regexp-groups/04-parse-expression/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
9-regular-expressions/11-regexp-groups/04-parse-expression/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.