public static void main(String[] args) { // String text3 = "啊啊啊标题@多项选择题描述@呵呵呵呵"; // String reg3 = "(?<=标题@)[\\s\\S]*(?=描述@)"; // Pattern p3 = Pattern.compile(reg3); // Matcher m3 = p3.matcher(text3); // if(m3.find()){ // System.out.println(m3.group()); // } String text = "Allowed with a fee of EUR 65.Not allowed for no-shows."; String newMessage = text.replaceAll(" ", ""); String reg = "(?<=EUR)[\\s\\S]*(?=.Not)"; Pattern p = Pattern.compile(reg); Matcher m = p.matcher(newMessage); String group=""; if(m.find()){ System.out.println(m.group()); group = m.group(); } System.out.println(group); while (StringUtils.isNoneBlank(group)){ System.out.println(group); } }