Cours numéro 2 :
---
#class: invert
---
## 4. REGEX
### 4.1. Késaco ?
*
* Aide au parsing de fichier
* Simple ou complexe, dépendamment du besoin
---
## 4. REGEX
### 4.2. Bases de compréhension (AND)
*
* `{}` : Nombre de caractères
---
## 4. REGEX
### 4.3. Bases de compréhension (OR)
*
* `|` : Séparateur
---
## 4. REGEX
### 4.4. Joker(s)
*
* `.*` : N'importe quel caratère, pas de limite de nombre
* `\` : Escape les caractères spéciaux
---
## 4. REGEX
### 4.5. Position
*
* `$` : Juste *avant* la fin de ligne
---
## 4. REGEX
### 4.5. Practice !
* 06.xx.xx.xx.xx
* 07.xx.xx.xx.xx
* 06-xx-xx-xx-xx
* 07-xx-xx-xx-xx
---
## 4. REGEX
### 4.6. Practice ! - correction
*
* <font style=style="color:blue">07</font>.xx.xx.xx.xx
* <font style=style="color:blue">06</font>-xx-xx-xx-xx
* <font style=style="color:blue">07</font>-xx-xx-xx-xx
Regex : <div style=style="visibility: hidden">(<font style=style="color:blue">06</font>|<font style=style="color:blue">07</font>)</div>
---
## 4. REGEX
### 4.6. Practice ! - correction
*
* <font style=style="color:blue">07</font>.xx.xx.xx.xx
* <font style=style="color:blue">06</font>-xx-xx-xx-xx
* <font style=style="color:blue">07</font>-xx-xx-xx-xx
Regex : (<font style=style="color:blue">06</font>|<font style=style="color:blue">07</font>)
---
## 4. REGEX
### 4.6. Practice ! - correction
*
* <font style=style="color:blue">07</font><font style=style="color:green">.</font>xx<font style=style="color:green">.</font>xx<font style=style="color:green">.</font>xx<font style=style="color:green">.</font>xx
* <font style=style="color:blue">06</font><font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx
* <font style=style="color:blue">07</font><font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx
Regex : (<font style=style="color:blue">06</font>|<font style=style="color:blue">07</font>)<div style=style="visibility: hidden">(<font style=style="color:green">\\.</font>|<font style=style="color:green">-</font>)</div>
---
## 4. REGEX
### 4.6. Practice ! - correction
*
* <font style=style="color:blue">07</font><font style=style="color:green">.</font>xx<font style=style="color:green">.</font>xx<font style=style="color:green">.</font>xx<font style=style="color:green">.</font>xx
* <font style=style="color:blue">06</font><font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx
* <font style=style="color:blue">07</font><font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx<font style=style="color:green">-</font>xx
Regex : (<font style=style="color:blue">06</font>|<font style=style="color:blue">07</font>)(<font style=style="color:green">\\.</font>|<font style=style="color:green">-</font>)
---
## 4. REGEX
### 4.6. Practice ! - correction
*
* <font style=style="color:blue">07</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font>
* <font style=style="color:blue">06</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font>
* <font style=style="color:blue">07</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font>
Regex : (<font style=style="color:blue">06</font>|<font style=style="color:blue">07</font>)(<font style=style="color:green">\\.</font>|<font style=style="color:green">-</font>)<div style=style="visibility: hidden">[<font style=style="color:red">0-9</font>]{<font style=style="color:red">2</font>}</div>
---
## 4. REGEX
### 4.6. Practice ! - correction
*
* <font style=style="color:blue">07</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font>
* <font style=style="color:blue">06</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font>
* <font style=style="color:blue">07</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font>
Regex : (<font style=style="color:blue">06</font>|<font style=style="color:blue">07</font>)(<font style=style="color:green">\\.</font>|<font style=style="color:green">-</font>)[<font style=style="color:red">0-9</font>]{<font style=style="color:red">2</font>}
---
## 4. REGEX
### 4.6. Practice ! - correction
*
* <font style=style="color:blue">07</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font><font style=style="color:green">.</font><font style=style="color:red">xx</font>
* <font style=style="color:blue">06</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font>
* <font style=style="color:blue">07</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font><font style=style="color:green">-</font><font style=style="color:red">xx</font>
Regex : (<font style=style="color:blue">06</font>|<font style=style="color:blue">07</font>)(<font style=style="color:green">\\.</font>[<font style=style="color:red">0-9</font>]{<font style=style="color:red">2</font>}|<font style=style="color:green">-</font>[<font style=style="color:red">0-9</font>]{<font style=style="color:red">2</font>}){4}