[EMAIL PROTECTED] wrote: > if your search is not overly complicated, i think regexp is not > needed. if you want, you can post a sample what you want to search, > and some sample input.
I'm afraid it's pretty complicated :-). I'm doing analysis of hand histories that online poker sites leave for you. Here's one hand of a play money ring game: Full Tilt Poker Game #2042984473: Table Play Chip 344 - 10/20 - Limit Hold'em - 18:07:20 ET - 2007/03/22 Seat 1: grandmarambo (1,595) Seat 4: justnoldfoolm (2,430) Seat 5: rickrn (1,890) Seat 7: harlan312 (820) Seat 8: moi (335) justnoldfoolm posts the small blind of 5 rickrn posts the big blind of 10 The button is in seat #1 *** HOLE CARDS *** Dealt to moi [Jd 2c] harlan312 calls 10 moi folds grandmarambo calls 10 justnoldfoolm raises to 20 rickrn folds harlan312 calls 10 grandmarambo calls 10 *** FLOP *** [7s 8s 2s] justnoldfoolm bets 10 harlan312 raises to 20 grandmarambo calls 20 justnoldfoolm raises to 30 harlan312 calls 10 grandmarambo calls 10 *** TURN *** [7s 8s 2s] [3d] justnoldfoolm bets 20 harlan312 calls 20 grandmarambo calls 20 *** RIVER *** [7s 8s 2s 3d] [7h] justnoldfoolm bets 20 harlan312 folds grandmarambo folds Uncalled bet of 20 returned to justnoldfoolm justnoldfoolm mucks justnoldfoolm wins the pot (220) *** SUMMARY *** Total pot 220 | Rake 0 Board: [7s 8s 2s 3d 7h] Seat 1: grandmarambo (button) folded on the River Seat 4: justnoldfoolm (small blind) collected (220), mucked Seat 5: rickrn (big blind) folded before the Flop Seat 7: harlan312 folded on the River Seat 8: moi didn't bet (folded) So I'm picking out all kinds of info about my cards, my stack, my betting, my position, board cards, other people's cards, etc. For example, this pattern picks out which player bet and how much: betsRe = re.compile('^(.*) bets ([\d,]*)') I have 13 such patterns. The files I'm analyzing are just a session's worth of histories like this, separated by \n\n\n. All of this information needs to be organized by hand or by when it happened in a hand, so I can't just run patterns over the whole file or I'll lose context. (Of course, in theory I could write a single monster expression that would chop it all up properly and organize by context, but it would be next to impossible to write/debug/maintain.) -- http://mail.python.org/mailman/listinfo/python-list