Been having problems parsing a line String from a CFG file,
the input string is:
String str = "The <animal> loves to <activity>.";
I've tried to use split with regex to split by the Non-terminals (<*>), however it's not producing the desired results:
What I've tried:
str.split("(?=<)");
Output:
"The ", "<animal> loves to", "<activity>."
Desired output:
"The ", "<animal>", " loves to ", "<activity>", "."