String s="For the AWSDataTransfer product, this is the public pricing plan";
JDKでREGEXを使用して(との間の単語)をAWSDataTransfer
抽出するにはどうすればよいですか?the
product
このような:
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