如果连续的大写单词在文档“I AM ALL UPPERCASE”中,我返回的是四个单独的大写单词。我需要的是返回整个大写“I AM ALL UPPERCASE”。我该怎么做呢?
String ucParensRegEx = "\([A-Z]+\)";
if (we.getParagraphText() != null) {
String[] dataArray = we.getParagraphText();
for (int i = 0; i < dataArray.length; i++) {
String data = dataArray[i].toString();
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(data);
while (m.find()) {
if (!sequences.contains(data.substring(m.start(), m.end())) && !data.equals("ARABIC") && !data.equals("ALATEC") && !data.equals("HYPERLINK")) {
sequences.add(data.substring(m.start(), m.end()));
System.out.println(data.substring(m.start(), m.end()));
Acronym acc = new Acronym(data.substring(m.start(), m.end()), data, false);
accronymList.add(acc);
}
}
}
}