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.
This commit is contained in:
Worros 2010-02-07 19:08:23 +08:00
parent ac458386da
commit ac51876200

View File

@ -103,7 +103,7 @@ class PokerStars(HandHistoryConverter):
self.re_Action = re.compile(r"""
^%(PLYR)s:(?P<ATYPE>\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat)
(\s(%(CUR)s)?(?P<BET>[.\d]+))?(\sto\s%(CUR)s(?P<BETTO>[.\d]+))? # the number discarded goes in <BET>
(\scards?(\s\[(?P<DISCARDED>.+?)\])?)?"""
(\s(cards)?(\s\[(?P<DISCARDED>.+?)\])?)?$"""
% subst, re.MULTILINE|re.VERBOSE)
self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P<CARDS>.*)\]" % player_re, re.MULTILINE)
self.re_CollectPot = re.compile(r"Seat (?P<SEAT>[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P<POT>[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE)