Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
tc_info:2023-td-texte-corr [2023/11/30 14:59] – [Exercice 4 : Expressions régulières] edauce | tc_info:2023-td-texte-corr [2023/12/01 09:49] (Version actuelle) – [Exercice 4 : Expressions régulières] edauce | ||
---|---|---|---|
Ligne 15: | Ligne 15: | ||
i <-- 0 | i <-- 0 | ||
tant que i < n - m: | tant que i < n - m: | ||
- | j < | + | j < |
tant que j < m et d[i+j] = t[j] : | tant que j < m et d[i+j] = t[j] : | ||
j += 1 | j += 1 | ||
Ligne 33: | Ligne 33: | ||
i <-- 0 | i <-- 0 | ||
tant que i < n - m: | tant que i < n - m: | ||
- | j < | + | j < |
tant que j < m et d[i+j] = t[j] : | tant que j < m et d[i+j] = t[j] : | ||
j += 1 | j += 1 | ||
Ligne 39: | Ligne 39: | ||
| | ||
i <-- i + 1 | i <-- i + 1 | ||
+ | retourner l | ||
</ | </ | ||
+ | |||
Cette approche a un inconvénient : après une comparaison infructueuse, | Cette approche a un inconvénient : après une comparaison infructueuse, | ||
Ligne 83: | Ligne 85: | ||
si c appartient à t: | si c appartient à t: | ||
k <-- dernière_occurrence(c, | k <-- dernière_occurrence(c, | ||
- | si k == m: | + | si k == m-1: |
| | ||
| | ||
Ligne 193: | Ligne 195: | ||
Correction : | Correction : | ||
< | < | ||
- | \d\d\d\d-(0[1-9]|1[12])-([0-2][0-9]|3[0-1]) \((0[0-9]|1[0-9]|2[0-3]): | + | \d\d\d\d-(0[1-9]|1[12])-(0[1-9]|[12][0-9]|3[0-1]) \((0[0-9]|1[0-9]|2[0-3]): |
</ | </ | ||