From ac51876200743ea58f0af8c5d74cb7e01801b731 Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 7 Feb 2010 19:08:23 +0800 Subject: [PATCH 1/3] PokerStarsTo Fpdb: Fix subtle bug in re_Action The bet action could become multiline greedy if there was a playername starting with 'card' in the next line. """ danny purse: bets $0.50 cardjunkie25: calls $0.50 """ Would match "danny purse: bets $0.50\ncard", and the rest of that line would be ignored. Added '$' to the end of the regex to make sure that it is limited to 1 line, and wrap 'cards' as a group. --- pyfpdb/PokerStarsToFpdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index c2a92881..fc63be91 100755 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -103,7 +103,7 @@ class PokerStars(HandHistoryConverter): self.re_Action = re.compile(r""" ^%(PLYR)s:(?P\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat) (\s(%(CUR)s)?(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))? # the number discarded goes in - (\scards?(\s\[(?P.+?)\])?)?""" + (\s(cards)?(\s\[(?P.+?)\])?)?$""" % subst, re.MULTILINE|re.VERBOSE) self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P.*)\]" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(r"Seat (?P[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE) From ee66abfecc1bce5b59748b31f73cd856ef739c39 Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 7 Feb 2010 19:19:00 +0800 Subject: [PATCH 2/3] Revert "PokerStarsTo Fpdb: Fix subtle bug in re_Action" This reverts commit ac51876200743ea58f0af8c5d74cb7e01801b731. --- pyfpdb/PokerStarsToFpdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index fc63be91..c2a92881 100755 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -103,7 +103,7 @@ class PokerStars(HandHistoryConverter): self.re_Action = re.compile(r""" ^%(PLYR)s:(?P\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat) (\s(%(CUR)s)?(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))? # the number discarded goes in - (\s(cards)?(\s\[(?P.+?)\])?)?$""" + (\scards?(\s\[(?P.+?)\])?)?""" % subst, re.MULTILINE|re.VERBOSE) self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P.*)\]" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(r"Seat (?P[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE) From b996a884debdc0568e78ed9312ce14ad099a746c Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 7 Feb 2010 19:21:32 +0800 Subject: [PATCH 3/3] PokerStarsTo? Fpdb: Fix subtle bug in re_Action The bet action could become multiline greedy if there was a playername starting with 'card' in the next line. """ danny purse: bets $0.50 cardjunkie25: calls $0.50 """ Would match "danny purse: bets $0.50\ncard", and the rest of that line would be ignored. Added '$' to the end of the regex to make sure that it is limited to 1 line --- pyfpdb/PokerStarsToFpdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index c2a92881..90a8bfd0 100755 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -103,7 +103,7 @@ class PokerStars(HandHistoryConverter): self.re_Action = re.compile(r""" ^%(PLYR)s:(?P\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat) (\s(%(CUR)s)?(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))? # the number discarded goes in - (\scards?(\s\[(?P.+?)\])?)?""" + (\scards?(\s\[(?P.+?)\])?)?$""" % subst, re.MULTILINE|re.VERBOSE) self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P.*)\]" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(r"Seat (?P[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE)