Код: Выделить всё
1 3 Hi [2 1 4]
< /code>
в массиве, как это: < /p>
[0] => "1"
[1] => "3"
[2] => "Hi"
[3] => "2 1 4"
< /code>
Это код: < /p>
String input = sc.nextLine();
Pattern p = Pattern.compile("(?
Подробнее здесь: [url]https://stackoverflow.com/questions/13426533/regex-pattern-to-match-positive-and-negative-number-values-in-a-string[/url]