I want to write some code that checks whether the input from user matches a specific format. The format is 's' followed by a space and a number, if the input was "s 1 2 3 4", it would call some function. "s 1 2" would also be acceptable. So far I found that this regex works for a specified amount of times:
if (inputLine.matches("s \\d+ \\d+")) { }
works for 2 numbers after the s, but I need to be able to accept any number of numbers after the s. Any idea on a regex that would suit my needs? Thank you