有没有一个正则表达式来计算顺子扑克牌手?
我使用字符串来表示排序后的牌,例如:
AAAAK#sssss = 4 aces and a king, all of spades.
A2345#ddddd = straight flush, all of diamonds.
在Java中,我正在使用以下正则表达式:
regexPair = Pattern.compile(".*(\\w)\\1.*#.*");
regexTwoPair = Pattern.compile(".*(\\w)\\1.*(\\w)\\2.*#.*");
regexThree = Pattern.compile(".*(\\w)\\1\\1.*#.*");
regexFour = Pattern.compile(".*(\\w)\\1{3}.*#.*");
regexFullHouse = Pattern.compile("((\\w)\\2\\2(\\w)\\3|(\\w)\\4(\\w)\\5\\5)#.*");
regexFlush = Pattern.compile(".*#(\\w)\\1{4}");
如何使用正则表达式计算连续值? 编辑 我开了另一个问题来解决同样的问题,但是使用字符的ASCII值,以便正则表达式更短。详见这里。
谢谢!
nobody@nowhere.com
是有效的,但(可能,我实际上没有检查过)背后没有任何人。最好的方法是发送一封激活类型的电子邮件进行检查。N小时内没有激活,请求将被丢弃。 - paxdiablo