System.out.println(
Arrays.deepToString(
\"abcghi\".split(\"(?:<)|(?:>)\")
)
);
This prints [abc, def, ghi]<
Thanks to information from Cine, I think these are the answers I'm looking for:
System.out.println(
Arrays.deepToString(
"abcghi".split("(?=<)|(?<=>)")
)
); // [abc, , ghi, , ]
System.out.println(
Arrays.deepToString(
"Hello! Oh my!! Good bye!! IT WORKS!!!".split("(?<=!++)")
)
); // [Hello!, Oh my!!, Good bye!!, IT WORKS!!!]
Now, the second one was honestly discovered by experimenting with all the different quantifiers. Neither greedy nor reluctant work, but possessive does.
I'm still not sure why.