0
String s="For the AWSDataTransfer product, this is the public pricing plan";

JDKでREGEXを使用して(との間の単語)をAWSDataTransfer抽出するにはどうすればよいですか?theproduct

4

1 に答える 1

4

このような:

String s="For the AWSDataTransfer product, this is the public pricing plan";
Pattern pattern = Pattern.compile("the\\s(.+?)\\sproduct");
Matcher matcher = pattern.matcher(s);
if (matcher.find()) {
    System.out.println(matcher.group(1));
}

出力:

AWSDataTransfer
于 2013-06-11T21:17:18.040 に答える