Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -*- coding: utf-8 -*- 

2""" 

3@file 

4@brief Arrays to display in notebooks. 

5""" 

6from io import StringIO 

7import pandas 

8 

9 

10def regex_cases(): 

11 text = """ 

12 Cas;Explications 

13 -------;Bases 

14 "a";a 

15 -------;Quantificateurs 

16 "abc?";ab suivi par 0 ou 1 c 

17 "abc*";ab suivi par 0.. c 

18 "abc+";ab suivi par 1.. c 

19 "abc{3}";ab suivi par 3 c 

20 "abc{3,5}";ab suivi par 3, 4 ou 5 c 

21 ;Groupes 

22 "(abc)+";1..8 abc 

23 "(a|b)c";ac ou bc 

24 -------;Intervalles (type 1) 

25 ".";n'importe quel caractère (un seul) 

26 "[aB9]";a ou B ou 9 

27 "[0-9]";n'importe quel caractère numérique 

28 "[a-zA-Z]";n'importe quel caractère alphabétique 

29 "[^a-c]";n'importe quel caractère SAUF a, b et c 

30 -------;Intervalles (type 2) 

31 "\\d";comme "[0-9]" 

32 "\\w";comme "[a-zA-Z0-9_]" 

33 "\\W";comme "[^a-zA-Z0-9_]" 

34 "\\s";espaces (" ", "\\n", "\\t", "\\r") 

35 "\\S";tout ce qui n'est pas un espace 

36 -------;Ancres 

37 "^abc";commence par "abc" 

38 "abc$";termine par "abc" 

39 """.replace(" ", "") 

40 df = pandas.read_csv(StringIO(text), sep=";").fillna('') 

41 return df