Scanner scanner = new Scanner(Com);
scanner.useDelimiter("^[\\d]{0,1000}[.][\\d]{0,1000}[\\s][\\D]{0,999}[\\s][\\w]{0,9999}$");
List<String> tokens = new ArrayList<>();
while (scanner.hasNext()) {
tokens.add(scanner.next().trim());
System.out.println(tokens.get(1));
}
if (tokens.isEmpty()) {
System.out.println("Empty!");
}
public class SomeClass {
public static void main(String... args) {
String com = "0.1 https://sitehere.com/files/ md5hashhere";
List<String> tokens = new ArrayList<>();
try (Scanner scanner = new Scanner(com)) {
while (scanner.hasNext()) {
tokens.add(scanner.next().trim());
}
}
System.out.println("tokens=" + tokens + ", tokens(1)=" + tokens.get(1));
// tokens=[0.1, https://sitehere.com/files/, md5hashhere], tokens(1)=https://sitehere.com/files/
}
}