I have two strings:
String one = "D -> B: 24"; // I am expecting array to have ['D','B','24']
String two = "route D -> C"; // expecting array to have ['D','C']
String myarray = input.split("\\s*(->|:|\\s)\\s*");
You want capitals and numbers - i.e.
[A-Z0-9]+. The simplest approach is to remove all leading and trailing non-matching chars - i.e.
[^A-Z0-9]+, then split on non-matching chars, like this:
String myarray = input.replaceAll("^[^A-Z0-9]+|[^A-Z0-9]+$", "").split("[^A-Z0-9]+");
BTW your posted code would produce
[route, D, C], not