Недавно я использовал мощь обычного регулярного выражения для разбиения строки:
"abc8".split("(?=\\d)|\\W")
При печати на консоль это выражение возвращает:
[abc, 8]
Очень доволен этим результатом, я хотел передать его в Guava для дальнейшей разработки, которая выглядела так:
Splitter.onPattern("(?=\\d)|\\W").split("abc8")
К моему удивлению, выход изменился на:
[abc]
Почему?