You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We already saw a similar thing -- square brackets. They allow to choose between multiple characters, for instance`pattern:gr[ae]y`matches `match:gray`or`match:grey`.
21
+
Abbiamo già incontrato una funzionalità simile: le parentesi quadre. Essi permettono di scegliere tra più caratteri, ad esempio`pattern:gr[ae]y`trova corrispondenza con `match:gray`o`match:grey`.
22
22
23
-
Square brackets allow only characters or character classes. Alternation allows any expressions. A regexp `pattern:A|B|C`means one of expressions`A`, `B`or`C`.
23
+
Le parentesi quadre consentono solo caratteri o classi di caratteri. L'alternanza consente qualsiasi espressione. Una regexp `pattern:A|B|C`significa una delle espressioni`A`, `B`o`C`.
24
24
25
-
For instance:
25
+
Per esempio:
26
26
27
-
-`pattern:gr(a|e)y`means exactly the same as`pattern:gr[ae]y`.
28
-
-`pattern:gra|ey`means`match:gra`or`match:ey`.
27
+
-`pattern:gr(a|e)y`ha lo stesso identico significato di`pattern:gr[ae]y`.
28
+
-`pattern:gra|ey`significa`match:gra`o`match:ey`.
29
29
30
-
To apply alternation to a chosen part of the pattern, we can enclose it in parentheses:
31
-
-`pattern:I love HTML|CSS`matches`match:I love HTML`or`match:CSS`.
32
-
-`pattern:I love (HTML|CSS)`matches `match:I love HTML`or`match:I love CSS`.
30
+
Per applicare l'alternanza ad una determinata parte di un pattern, dobbiamo racchiuderla tra parentesi:
31
+
-`pattern:I love HTML|CSS`trova`match:I love HTML`o`match:CSS`.
32
+
-`pattern:I love (HTML|CSS)`corrisponde a `match:I love HTML`o`match:I love CSS`.
33
33
34
-
## Example: regexp for time
34
+
## Esempio: una regexp per un orario
35
35
36
36
In previous articles there was a task to build a regexp for searching time in the form `hh:mm`, for instance `12:00`. But a simple `pattern:\d\d:\d\d` is too vague. It accepts `25:99` as the time (as 99 minutes match the pattern, but that time is invalid).
0 commit comments