import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "Seat (?P<playerseat>[0-9]+): (?P<playername>[.?]+)";
final String string = "he name of first value, first 17/04/2013 11:30:00 - A:30.0\n\n"
+ "PokerStars Hand #152844641611: Tournament #1556870024, $0.44+$0.44+$0.12 USD Hold'em No Limit - Level I (25/50) - 2016/05/04 13:15:07 BRT [2016/05/04 12:15:07 ET]\n"
+ "Table '1556870024 3' 6-max Seat #1 is the button\n"
+ "Seat 1: vitalijus (500 in chips) \n"
+ "Seat 2: papoca555 (500 in chips) \n"
+ "Seat 3: SITBACKNOW (500 in chips) \n"
+ "Seat 4: hackerpex (500 in chips) \n"
+ "Seat 5: vovan189 (500 in chips) \n"
+ "Seat 6: DiMers80 (500 in chips) \n"
+ "vitalijus: posts the ante 10\n"
+ "papoca555: posts the ante 10\n"
+ "SITBACKNOW: posts the ante 10\n"
+ "hackerpex: posts the ante 10\n"
+ "vovan189: posts the ante 10 \n"
+ "DiMers80: posts the ante 10\n"
+ "papoca555: posts small blind 25\n"
+ "SITBACKNOW: posts big blind 50\n"
+ "*** HOLE CARDS ***\n"
+ "Dealt to hackerpex [7h 6h]\n"
+ "hackerpex: folds \n"
+ "vovan189: calls 50\n"
+ "DiMers80: raises 440 to 490 and is all-in\n"
+ "vitalijus: folds \n"
+ "papoca555: folds \n"
+ "SITBACKNOW: calls 440 and is all-in\n"
+ "vovan189: calls 440 and is all-in\n"
+ "*** FLOP *** [5c 2c 3s]\n"
+ "*** TURN *** [5c 2c 3s] [Ah]\n"
+ "*** RIVER *** [5c 2c 3s Ah] [4s]\n"
+ "*** SHOW DOWN ***\n"
+ "SITBACKNOW: shows [Ks Tc] (a straight, Ace to Five)\n"
+ "vovan189: shows [6d As] (a straight, Deuce to Six)\n"
+ "DiMers80: shows [Kc Th] (a straight, Ace to Five)\n"
+ "vovan189 collected 1555 from pot\n"
+ "vovan189 wins the $0.44 bounty for eliminating SITBACKNOW\n"
+ "vovan189 wins the $0.44 bounty for eliminating DiMers80\n"
+ "SITBACKNOW finished the tournament in 35th place\n"
+ "DiMers80 finished the tournament in 35th place\n"
+ "*** SUMMARY ***\n"
+ "Total pot 1555 | Rake 0 \n"
+ "Board [5c 2c 3s Ah 4s]\n"
+ "Seat 1: vitalijus (button) folded before Flop (didn't bet)\n"
+ "Seat 2: papoca555 (small blind) folded before Flop\n"
+ "Seat 3: SITBACKNOW (big blind) showed [Ks Tc] and lost with a straight, Ace to Five\n"
+ "Seat 4: hackerpex folded before Flop (didn't bet)\n"
+ "Seat 5: vovan189 showed [6d As] and won (1555) with a straight, Deuce to Six\n"
+ "Seat 6: DiMers80 showed [Kc Th] and lost with a straight, Ace to Five\n"
+ "PokerStars Hand #152844655854: Tournament #1556870024, $0.44+$0.44+$0.12 USD Hold'em No Limit - Level I (25/50) - 2016/05/04 13:15:28 BRT [2016/05/04 12:15:28 ET]\n"
+ "Table '1556870024 3' 6-max Seat #2 is the button\n"
+ "Seat 1: vitalijus (490 in chips) \n"
+ "Seat 2: papoca555 (465 in chips) \n"
+ "Seat 4: hackerpex (490 in chips) \n"
+ "Seat 5: vovan189 (1555 in chips) \n"
+ "vitalijus: posts the ante 10\n"
+ "papoca555: posts the ante 10\n"
+ "hackerpex: posts the ante 10\n"
+ "vovan189: posts the ante 10\n"
+ "hackerpex: posts small blind 25\n"
+ "vovan189: posts big blind 50\n"
+ "*** HOLE CARDS ***\n"
+ "Dealt to hackerpex [Jd Ad]";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html