Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
String s="For the AWSDataTransfer product, this is the public pricing plan";
如何在 JDK 中使用 REGEX提取(和AWSDataTransfer之间的单词)?theproduct
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)); }
输出: