sup Posted July 2, 2010 Share Posted July 2, 2010 Hello experts, I have a log from a poker game, for example: Full Tilt Poker Game #12352499014: $5 + $0.25 Heads Up Sit & Go (92219476), Table 1 - 10/20 - No Limit Hold\'em - 15:58:46 ET - 2009/05/21 Seat 1: michael bass (1,360) Seat 2: boisbois (1,640) boisbois posts the small blind of 10 michael bass posts the big blind of 20 The button is in seat #2 *** HOLE CARDS *** Dealt to boisbois [Qc Kd] boisbois raises to 40 michael bass raises to 120 boisbois calls 80 *** FLOP *** [2c Ts Ad] michael bass checks boisbois checks *** TURN *** [2c Ts Ad] [6c] michael bass checks boisbois checks *** RIVER *** [2c Ts Ad 6c] [As] michael bass checks boisbois checks *** SHOW DOWN *** michael bass shows [Tc Ah] a full house, Aces full of Tens boisbois mucks michael bass wins the pot (240) with a full house, Aces full of Tens *** SUMMARY *** Total pot 240 | Rake 0 Board: [2c Ts Ad 6c As] Seat 1: michael bass (big blind) showed [Tc Ah] and won (240) with a full house, Aces full of Tens Seat 2: boisbois (small blind) mucked [Qc Kd] - a pair of Aces And I've succesfully extracted the playernames & seating numbers by making this regex: preg_match_all('/Seat ([0-9]+):\\ (.*)\\ \\(/', $raw, $seatingresult, PREG_PATTERN_ORDER); $players = $seatingresult[2]; $seats = $seatingresult[1]; $maxseats = max($seats); But now I want to extract the number (stacksize) behind the playername. For exmaple: get the 1,360 from "Seat 1: michael bass (1,360)" I have tried preg_match_all('/Seat ([0-9]+):\\ (.*)\\ \\(.*)\\)/', $raw, $stacksresult, PREG_PATTERN_ORDER); $stack = $stacksresult[3]; echo "Stack 1 = $stack[0]"; But I get an error: Warning: preg_match_all() [function.preg-match-all]: Compilation failed: unmatched parentheses at offset 28 in /home2/p0kermlt/public_html/pokerh/test.php on line 92 Can any1 bump me in the right direction? Link to comment https://forums.phpfreaks.com/topic/206493-need-a-little-help-with-my-preg-match-regex/ Share on other sites More sharing options...
Adam Posted July 2, 2010 Share Posted July 2, 2010 Try: /Seat ([0-9]+): (.*?) \(([0-9,]+)\)/ Link to comment https://forums.phpfreaks.com/topic/206493-need-a-little-help-with-my-preg-match-regex/#findComment-1080151 Share on other sites More sharing options...
sup Posted July 2, 2010 Author Share Posted July 2, 2010 Thanks, I changed it to preg_match_all('/Seat ([0-9]+):\ (.*)\ \((.*)\)/', $raw, $seatingresult, PREG_PATTERN_ORDER); $players = $seatingresult[2]; $seats = $seatingresult[1]; $stacks = $seatingresult[3]; Now I got all the info Link to comment https://forums.phpfreaks.com/topic/206493-need-a-little-help-with-my-preg-match-regex/#findComment-1080154 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.