Bonjour,
Je souhaite creer une regex qui couvre un large champ de possibilité; je souhaite parser un historique de main de poker et voila quelques exemples de lignes différentes à parser :
Voici la regexp que j'ai créer :Code:
1
2
3
4
5 Seat 2: gil1612 showed [9s Kh] and won 800 with One pair : 9 Seat 4: DIAMOND01 (small blind) showed [8d Ac] and lost with One pair : 8 :mouarf: Seat 6: Space23 folded on the pre-flop Seat 3: pupuce2307 (button) showed [Ah Js] and won 3140 with Straight Jack high
Cependant cela ne me capture pas les groupes que je souhaite :Code:Seat (\w): (\S*) (\(small blind\)|\(big blind\))?\s??(\(button\))?\s??(showed|folded)?\s??(\[\w\w \w\w\])?\s??[and]?? (won|lost)?\s??(\d*?)\s??[with ]?(.*)
Le dernier groupe devrait être dispatché en plusieurs groupes.Code:
1
2
3
4
5
6
7
8
9
10
11 Seat 2: gil1612 showed [9s Kh] and won 800 with One pair : 9 Groupe 0 = Seat 2: gil1612 showed [9s Kh] and won 800 with One pair : 9 Groupe 1 = 2 Groupe 2 = gil1612 Groupe 3 = null Groupe 4 = null Groupe 5 = showed Groupe 6 = null Groupe 7 = null Groupe 8 = Groupe 9 = [9s Kh] and won 800 with One pair : 9
Le groupe 9 devrait se trouver sur le groupe 8.Code:
1
2
3
4
5
6
7
8
9
10
11
12 Seat 2: gil1612 (button) won 820 Concordance 1: Début = 0, Fin = 32 Groupe 0 = Seat 2: gil1612 (button) won 820 Groupe 1 = 2 Groupe 2 = gil1612 Groupe 3 = null Groupe 4 = (button) Groupe 5 = null Groupe 6 = null Groupe 7 = won Groupe 8 = Groupe 9 = 820
Est-ce que vous avez une idée du problème de ma regex?